-
Notifications
You must be signed in to change notification settings - Fork 263
/
phpcs.xml.dist
166 lines (138 loc) · 8.2 KB
/
phpcs.xml.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0"?>
<ruleset>
<arg name="basepath" value="." />
<arg name="extensions" value="php" />
<arg name="parallel" value="80" />
<arg name="cache" value=".phpcs-cache" />
<arg name="colors" />
<!-- Ignore warnings (n), show progress of the run (p), and show sniff names (s) -->
<arg value="nps"/>
<file>benchmark/src</file>
<file>src</file>
<file>examples</file>
<file>generator/src</file>
<file>generator/config</file>
<file>tests</file>
<file>tools</file>
<file>rector.php</file>
<!-- Ignore auto-generated code -->
<exclude-pattern>src/Builder/(Accumulator|Expression|Query|Projection|Search|Stage)/*\.php</exclude-pattern>
<!-- Target minimum supported PHP version -->
<config name="php_version" value="80100"/>
<!-- ****************************************** -->
<!-- Import rules from doctrine/coding-standard -->
<!-- ****************************************** -->
<rule ref="Doctrine">
<!-- *********************************** -->
<!-- Exclude sniffs that cause BC breaks -->
<!-- *********************************** -->
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming" />
<!-- Can cause subtle BC breaks -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" />
<!-- **************************************** -->
<!-- Exclude sniffs that force unwanted style -->
<!-- **************************************** -->
<exclude name="Generic.Formatting.MultipleStatementAlignment" />
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" />
<exclude name="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat.DisallowedShortNullable" />
<!-- Keep long typehints (for now) -->
<exclude name="PSR12.Keywords.ShortFormTypeKeywords" />
<exclude name="SlevomatCodingStandard.PHP.TypeCast.InvalidCastUsed" />
<exclude name="SlevomatCodingStandard.TypeHints.LongTypeHints" />
<!-- ************************************************ -->
<!-- Exclude sniffs that may cause functional changes -->
<!-- ************************************************ -->
<exclude name="Generic.PHP.ForbiddenFunctions.FoundWithAlternative" />
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit" />
<exclude name="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" />
<exclude name="SlevomatCodingStandard.Functions.StaticClosure" />
<exclude name="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
<exclude name="SlevomatCodingStandard.Operators.DisallowEqualOperators" />
<!-- ********************************************************* -->
<!-- Exclude sniffs that cause a huge diff - enable separately -->
<!-- ********************************************************* -->
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup" />
<!-- ********************* -->
<!-- Exclude broken sniffs -->
<!-- ********************* -->
<!-- Sniff currently broken when casting arrays, see https://github.com/squizlabs/PHP_CodeSniffer/issues/2937#issuecomment-615498860 -->
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline" />
<!-- Disable forbidden annotation sniff as excluding @api from the list doesn't work -->
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden" />
</rule>
<!-- **************************************** -->
<!-- Enable rules not enforced by Doctrine CS -->
<!-- **************************************** -->
<!-- Require arrow functions where possible -->
<rule ref="SlevomatCodingStandard.Functions.RequireArrowFunction"/>
<!-- Forbid fully qualified names even for colliding names -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFallbackGlobalConstants" value="false"/>
<property name="allowFallbackGlobalFunctions" value="false"/>
<property name="allowFullyQualifiedGlobalClasses" value="false"/>
<property name="allowFullyQualifiedGlobalConstants" value="false"/>
<property name="allowFullyQualifiedGlobalFunctions" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingClasses" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingConstants" value="false"/>
<property phpcs-only="true" name="allowFullyQualifiedNameForCollidingFunctions" value="false"/>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- ****************************************************** -->
<!-- Don't require annotations to specify traversable types -->
<!-- ****************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- ************************************************************************** -->
<!-- Require type hints for all parameters, properties, and return types in src -->
<!-- ************************************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint">
<exclude-pattern>tests</exclude-pattern>
</rule>
<!-- *********************************************************** -->
<!-- Require native type hints for all code without a BC promise -->
<!-- *********************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern>src</exclude-pattern>
</rule>
<!-- ************************************************************* -->
<!-- Ignore errors for certain files where this is part of the API -->
<!-- ************************************************************* -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>/src/GridFS/StreamWrapper</exclude-pattern>
<exclude-pattern>/tests/DocumentationExamplesTest.php</exclude-pattern>
<exclude-pattern>/tests/GridFS/UnusableStream.php</exclude-pattern>
<exclude-pattern>/tests/SpecTests/ClientSideEncryption/Prose*</exclude-pattern>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>/examples</exclude-pattern>
<exclude-pattern>/tests/PHPUnit/ConstraintTrait.php</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>/examples</exclude-pattern>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>/tests/SpecTests/*/Prose*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint.UselessDocComment">
<exclude-pattern>src/Builder/Type/OperatorInterface.php</exclude-pattern>
</rule>
</ruleset>