-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphpcs.xml.dist
404 lines (360 loc) · 19.4 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<?xml version="1.0"?>
<ruleset name="OwlCorp DoctrineMicrotime" namespace="OwlCorp\DoctrineMicrotime\PhpCS\Standard">
<!-- ############################################################################ -->
<!-- DO NOT COPY THIS FILE AS A TEMPLATE -->
<!-- many good rules were removed to support old PHP versions -->
<!-- ############################################################################ -->
<config name="installed_paths" value="../../slevomat/coding-standard"/>
<ini name="memory_limit" value="512M"/>
<arg name="colors"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8" />
<autoload>./vendor/autoload.php</autoload>
<file>src</file>
<file>tests</file>
<!-- Don't hide tokenizer exceptions.. this was painful to find -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<rule ref="PSR2"/>
<!-- ############################################################################ -->
<!-- PHPCS built-in rules -->
<!-- ############################################################################ -->
<rule ref="Generic.Files.LineLength.TooLong" />
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<!-- Use proper logging facilities -->
<element key="echo" value="null"/>
<element key="print" value="null"/>
<element key="var_dump" value="null"/>
<element key="dump" value="null"/>
<element key="dd" value="null"/>
<element key="xdebug_break" value="null"/> <!-- use proper breakpoints... -->
<element key="is_null" value="null"/> <!-- Use "$x === null" instead -->
<element key="die" value="null"/> <!-- Replace by proper code return or exception -->
<element key="create_function" value="null"/> <!-- Deprecated, use lambdas -->
<element key="eval" value="null"/> <!-- Does this need a comment? -->
<element key="goto" value="null"/> <!-- https://xkcd.com/292/ -->
<element key="define" value="null"/> <!-- Use const keyword -->
<!-- Use proper syntax -->
<element key="extract" value="null"/>
<element key="call_user_func" value="null"/>
<element key="call_user_func_array" value="null"/>
</property>
</properties>
</rule>
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="15" />
<property name="absoluteComplexity" value="15" />
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel" />
<!-- ############################################################################ -->
<!-- Sourced from https://github.com/slevomat/coding-standard -->
<!-- ############################################################################ -->
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/arrays.md -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation" />
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement" />
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace" />
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/attributes.md -->
<rule ref="SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment" />
<rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0" />
<property name="spacesCountBeforeType" value="1" />
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/classes.md -->
<rule ref="SlevomatCodingStandard.Classes.ClassLength" />
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing">
<properties>
<property name="linesCountBetweenMembers" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing">
<properties>
<property name="linesCountBetweenMembers" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="1" />
<property name="maxLinesCountBeforeWithComment" value="2" />
<property name="minLinesCountBeforeWithoutComment" value="0" />
<property name="maxLinesCountBeforeWithoutComment" value="2" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" /> <!-- this makes a hot mess in git -->
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" /> <!-- this makes a hot mess in git -->
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0" />
<property name="linesCountBeforeClosingBrace" value="0" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
<properties>
<property name="minLinesCount" value="1" />
<property name="maxLinesCount" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration">
<properties>
<property name="checkPromoted" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="1" />
<property name="maxLinesCountBeforeWithComment" value="2" />
<property name="minLinesCountBeforeWithoutComment" value="0" />
<property name="maxLinesCountBeforeWithoutComment" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion" />
<rule ref="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature">
<properties>
<!-- I know PSR, we have wide screens ffs - 120 is STILL within the limits of the standard -->
<property name="minLineLength" value="120" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature">
<properties>
<property name="maxLineLength" value="80" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration" /> <!-- this makes a hot mess in git -->
<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
<properties>
<property name="linesCountBeforeFirstUse" value="0" />
<property name="linesCountBeforeFirstUseWhenFirstInClass" value="0" />
<property name="linesCountBetweenUses" value="0" />
<property name="linesCountAfterLastUse" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/commenting.md -->
<rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration" />
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@author" />
<element value="@created" />
<element value="@version" />
<element value="@package" />
<element value="@copyright" />
<element value="@license" />
<element value="@throws" />
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
<properties>
<property name="forbiddenCommentPatterns" type="array">
<element value="/^Constructor/i" />
<element value="/^Created by /i" />
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration">
<properties>
<property name="allowDocCommentAboveReturn" value="true" />
<property name="allowAboveNonAssignment" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment" />
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/complexity.md -->
<rule ref="SlevomatCodingStandard.Complexity.Cognitive">
<properties>
<property name="maxComplexity" value="7" /> <!-- bundle contains a lot of performance-sensitive code -->
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/control-structures.md -->
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition" />
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
<properties>
<property name="ignoreStandaloneIfInScope" value="true" />
<property name="ignoreOneLineTrailingIf" value="true" />
<property name="ignoreTrailingIfWithOneInstruction" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch" />
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowEmpty" /> <!-- No reason to sue in PHP8 -->
<rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses" />
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator" />
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/exceptions.md -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/files.md -->
<rule ref="SlevomatCodingStandard.Files.FileLength">
<exclude-pattern>src/DataFixture/GeneratorProvider/</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Files.LineLength">
<properties>
<property name="lineLengthLimit" value="120" />
<property name="ignoreComments" value="true" />
<property name="ignoreImports" value="true" />
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/functions.md -->
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
<properties>
<property name="spacesCountAfterKeyword" value="1" />
<property name="spacesCountBeforeArrow" value="1" />
<property name="spacesCountAfterArrow" value="1" />
<property name="allowMultiLine" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction" />
<rule ref="SlevomatCodingStandard.Functions.FunctionLength">
<properties>
<property name="maxLinesLength" value="35" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.RequireArrowFunction">
<properties>
<property name="allowNested" value="false" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration" />
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />
<rule ref="SlevomatCodingStandard.Functions.StrictCall" />
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
<rule ref="SlevomatCodingStandard.Functions.UnusedParameter" />
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/namespaces.md -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="psr12Compatible" value="true" />
<property name="caseSensitive" value="false" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse" />
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants" />
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions" />
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine" />
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration" />
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
<properties>
<property name="linesCountBeforeNamespace" value="1" />
<property name="linesCountAfterNamespace" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile" />
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="searchAnnotations" value="true" />
<property name="allowFullyQualifiedNameForCollidingClasses" value="true" />
<property name="allowFullyQualifiedNameForCollidingFunctions" value="true" />
<property name="allowFullyQualifiedNameForCollidingConstants" value="true" />
<property name="allowFullyQualifiedGlobalClasses" value="true" />
<property name="allowFullyQualifiedGlobalFunctions" value="true" />
<property name="allowFullyQualifiedGlobalConstants" value="true" />
<property name="allowFallbackGlobalFunctions" value="true" />
<property name="allowFallbackGlobalConstants" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
<properties>
<property name="linesCountBeforeFirstUse" value="1" />
<property name="linesCountAfterLastUse" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true" />
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/numbers.md -->
<rule ref="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator">
<properties>
<property name="minDigitsBeforeDecimalPoint" value="5" />
<property name="ignoreOctalNumbers" value="true" />
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/operators.md -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators" />
<rule ref="SlevomatCodingStandard.Operators.NegationOperatorSpacing">
<properties>
<property name="spacesCount" value="0" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator" />
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing">
<properties>
<property name="spacesCountAfterOperator" value="0" />
</properties>
</rule>
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/php.md -->
<rule ref="SlevomatCodingStandard.PHP.DisallowDirectMagicInvokeCall" /> <!-- no magic methods should be called directly... -->
<rule ref="SlevomatCodingStandard.PHP.DisallowReference" /> <!-- objects should be used instead when such behavior is desired -->
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses" />
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/type-hints.md -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="linesCountBeforeDeclare" value="0" />
<property name="spacesCountAroundEqualsSign" value="0" />
<property name="linesCountAfterDeclare" value="1" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax">
<properties>
<property name="traversableTypeHints" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" />
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition" />
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" />
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing" />
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
<property name="enableNativeTypeHint" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat" />
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/variables.md -->
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable" />
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
<properties>
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
<!-- Docs: https://github.com/slevomat/coding-standard/blob/master/doc/whitespaces.md -->
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
<properties>
<property name="ignoreSpacesBeforeAssignment" value="true" />
<property name="ignoreSpacesInAnnotation" value="true" />
<property name="ignoreSpacesInComment" value="true" />
<property name="ignoreSpacesInParameters" value="true" />
<property name="ignoreSpacesInMatch" value="true" />
</properties>
</rule>
</ruleset>