-
Notifications
You must be signed in to change notification settings - Fork 20
/
phpcs.xml.dist
652 lines (625 loc) · 32 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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<?xml version="1.0"?>
<ruleset
name="croct/math"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<description>The coding standard for antlr/antlr4-php-runtime.</description>
<config name="installed_paths" value="../../slevomat/coding-standard/SlevomatCodingStandard"/>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="colors" />
<!-- show progress of the run and show sniff names -->
<arg value="ps"/>
<!-- Force array element indentation with 4 spaces -->
<rule ref="Generic.Arrays.ArrayIndent"/>
<!-- Disallow `array(...)` -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Disallow duplicate classes -->
<rule ref="Generic.Classes.DuplicateClassName"/>
<!-- Disallow empty statements -->
<rule ref="Generic.CodeAnalysis.EmptyStatement">
<!-- But allow empty catch -->
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
</rule>
<!-- Disallow final methods in final classes -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<!-- Disallow useless empty method overrides -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<!-- Disallow inline HTML in PHP code -->
<rule ref="Generic.Files.InlineHTML"/>
<!-- Warn about lines longer than 120 chars -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120" />
</properties>
</rule>
<!-- Align corresponding assignment statement tokens -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="1" />
<property name="error" value="true"/>
</properties>
</rule>
<!-- Force whitespace after a type cast -->
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<!-- Disallow PHP 4 constructors -->
<rule ref="Generic.NamingConventions.ConstructorName"/>
<!-- Disallow backtick operator -->
<rule ref="Generic.PHP.BacktickOperator"/>
<!-- Disallow any content before opening tag -->
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
<!-- Disallow deprecated functions -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<!-- Disallow alias functions, i.e. `sizeof()`, `delete()` -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="chop" value="rtrim"/>
<element key="close" value="closedir"/>
<element key="compact" value="null"/>
<element key="delete" value="unset"/>
<element key="doubleval" value="floatval"/>
<element key="extract" value="null"/>
<element key="fputs" value="fwrite"/>
<element key="ini_alter" value="ini_set"/>
<element key="is_double" value="is_float"/>
<element key="is_integer" value="is_int"/>
<element key="is_long" value="is_int"/>
<element key="is_null" value="null"/>
<element key="is_real" value="is_float"/>
<element key="is_writeable" value="is_writable"/>
<element key="join" value="implode"/>
<element key="key_exists" value="array_key_exists"/>
<element key="pos" value="current"/>
<element key="settype" value="null"/>
<element key="show_source" value="highlight_file"/>
<element key="sizeof" value="count"/>
<element key="strchr" value="strstr"/>
</property>
</properties>
</rule>
<!-- Force PHP 7 param and return types to be lowercased -->
<rule ref="Generic.PHP.LowerCaseType"/>
<!-- Disallow `php_sapi_name()` function -->
<rule ref="Generic.PHP.SAPIUsage"/>
<!-- Disallow useless inline string concatenation -->
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<!-- But multiline is useful for readability -->
<properties>
<property name="allowMultiline" value="true"/>
</properties>
</rule>
<!-- PEAR sniffs -->
<!-- Disallow comments starting with # -->
<rule ref="PEAR.Commenting.InlineComment"/>
<!-- Force indent of each line in a multi-line object chain -->
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent">
<properties>
<property name="indent" value="4" />
<property name="multilevel" value="true" />
</properties>
</rule>
<!-- PSR-2 sniffs -->
<!-- PSR-2 coding standard (base) -->
<rule ref="PSR2">
<!-- Checked by SlevomatCodingStandard.Namespaces.UseSpacing -->
<exclude name="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse"/>
<!-- Checked by SlevomatCodingStandard.Namespaces.NamespaceSpacing -->
<exclude name="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter"/>
<!-- Checked by Croct.NamingConvention.CamelCapsMethodNameSniff -->
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
</rule>
<!-- Disallow `else if` in favor of `elseif` -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
<type>error</type>
</rule>
<!-- SlevomatCodingStandard sniffs -->
<!-- Disallow implicit array creation -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation" />
<!-- Enforces reasonable end bracket placement for multi-line arrays -->
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement" />
<!-- Require comma after last element in multi-line array -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<!-- Require presence of constant visibility -->
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">
<properties>
<property name="fixable" value="true"/>
</properties>
</rule>
<!-- Checks that there is a certain number of blank lines between constants -->
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing"/>
<!-- Disallows multi constant definition -->
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition"/>
<!-- Disallows multi property definition -->
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition"/>
<!-- Disallow empty lines around type declarations -->
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0"/>
<property name="linesCountBeforeClosingBrace" value="0"/>
</properties>
</rule>
<!-- Class names should be referenced via ::class constant when possible -->
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference">
<properties>
<!-- Enable `::class` on all objects -->
<property name="enableOnObjects" value="true"/>
</properties>
</rule>
<!-- Checks that there is a certain number of blank lines between properties -->
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="1"/>
<property name="maxLinesCountBeforeWithComment" value="1"/>
<property name="minLinesCountBeforeWithoutComment" value="1"/>
<property name="maxLinesCountBeforeWithoutComment" value="1"/>
</properties>
</rule>
<!-- Checks that there is a certain number of blank lines between methods -->
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
<properties>
<property name="minLinesCount" value="1"/>
<property name="maxLinesCount" value="1"/>
</properties>
</rule>
<!-- Enforces method signature to be splitted to more lines so each parameter is on its own line -->
<rule ref="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature">
<properties>
<property name="minLineLength" value="121"/>
</properties>
</rule>
<!-- Enforces method signature to be on a single line -->
<rule ref="SlevomatCodingStandard.Classes.RequireSingleLineMethodSignature">
<properties>
<property name="maxLineLength" value="80"/>
</properties>
</rule>
<!-- Reports use of superfluous prefix or suffix "Abstract" for abstract classes -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<!-- Reports use of superfluous prefix or suffix "Interface" for interfaces -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<!-- Reports use of superfluous suffix "Trait" for traits -->
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<!-- Disallow uses of multiple traits separated by comma -->
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
<!-- Disallow uses of constructor property promotion -->
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="linesCountBeforeFirstContent" value="0"/>
<property name="linesCountAfterLastContent" value="0"/>
<property name="linesCountBetweenDescriptionAndAnnotations" value="1"/>
<property name="linesCountBetweenAnnotationsGroups" value="1"/>
<property name="annotationsGroups" type="array">
<element value="
@Given,
@When,
@Then,
@And,
@But,
"/>
<element value="
@template,
@template-covariant,
"/>
<element value="
@extends,
@implements,
"/>
<element value="
@internal,
@deprecated,
"/>
<element value="
@ORM\,
@ODM\,
"/>
<element value="
@testdox,
@requires,
@covers,
@coversNothing,
@coversDefaultClass,
@dataProvider,
@doesNotPerformAssertions,
@expectedException,
@expectedExceptionCode,
@expectedExceptionMessage,
@expectedExceptionMessageRegExp,
"/>
<element value="@param"/>
<element value="@return"/>
<element value="@throws"/>
<element value="
@method,
"/>
<element value="
@link,
@see,
@uses,
"/>
<element value="
@author,
@since,
"/>
</property>
</properties>
</rule>
<!-- Disallow empty comments -->
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
<!-- Disallow useless annotations - Git and LICENCE file provide more accurate information -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@api"/>
<element value="@category"/>
<element value="@copyright"/>
<element value="@created"/>
<element value="@license"/>
<element value="@package"/>
<element value="@subpackage"/>
<element value="@version"/>
<element value="@test"/>
</property>
</properties>
</rule>
<!-- Disallow useless comments -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
<properties>
<property name="forbiddenCommentPatterns" type="array">
<element value="~^(?:(?!private|protected|static)\S+ )?(?:con|de)structor\.\z~i"/>
<element value="~^Created by \S+\.\z~i"/>
<element value="~^\S+ [gs]etter\.\z~i"/>
</property>
</properties>
</rule>
<!-- Report invalid format of inline phpDocs with `@var` -->
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
<!-- Require comments with single line written as one-liners -->
<rule ref="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/>
<!-- Disallows assignments in if, elseif and do-while loop conditions -->
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
<!-- Disallows use of continue without integer operand in switch because it emits a warning in PHP 7.3 and higher -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
<!-- Disallow fancy yoda conditions -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
<!-- Enforces configurable number of lines around jump statements (continue, return, ...) -->
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
<properties>
<property name="linesCountAfterWhenLastInCaseOrDefault" value="1"/>
<property name="linesCountAfterWhenLastInLastCaseOrDefault" value="0"/>
<property name="linesCountAfter" value="1"/>
<property name="linesCountAfterLast" value="0"/>
</properties>
</rule>
<!-- Checks and fixes language construct used with parentheses -->
<rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses"/>
<!-- Requires new with parentheses -->
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
<!-- Require short ternary operator `?:` when possible -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator"/>
<!-- Ternary operator has to be reformatted to more lines when the line length exceeds the given limit -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireMultiLineTernaryOperator">
<properties>
<property name="lineLengthLimit" value="120"/>
</properties>
</rule>
<!-- Requires use of null coalesce operator when possible -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<!-- Requires use of null coalesce equal operator when possible -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
<!-- Report useless conditions where both branches return true or false -->
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
<!-- Report useless ternary operator where both branches return true or false -->
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator"/>
<!-- Enforce null-safe operation whenever applicable -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullSafeObjectOperator"/>
<!-- Checks fn declaration -->
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
<properties>
<property name="spacesCountAfterKeyword" value="1"/>
<property name="spacesCountBeforeArrow" value="1"/>
<property name="spacesCountAfterArrow" value="1"/>
</properties>
</rule>
<!-- Reports empty functions body and requires at least a comment inside -->
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
<!-- Reports closures not using $this that are not declared static -->
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<!-- Looks for useless parameter default value -->
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue"/>
<!-- Disallow unused variables passed to closures via `use` -->
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<!-- Enforces trailing commas in multi-line function declarations -->
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
<!-- Enforces trailing commas in multi-line calls -->
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInCall"/>
<!-- Require use statements to be alphabetically sorted -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="caseSensitive" value="false"/>
</properties>
</rule>
<!-- Group use declarations are ugly, make diffs ugly and this sniff prohibits them -->
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
<!-- Prohibits multiple uses separated by commas -->
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
<!-- Enforces one space after namespace -->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceDeclaration"/>
<!-- Enforces configurable number of lines before and after namespace -->
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing">
<properties>
<property name="linesCountBeforeNamespace" value="1"/>
<property name="linesCountAfterNamespace" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="allowFullyQualifiedGlobalClasses" value="true"/>
<property name="allowFullyQualifiedGlobalFunctions" value="true"/>
<property name="allowFullyQualifiedGlobalConstants" value="true"/>
</properties>
</rule>
<!-- Requires only one namespace in a file -->
<rule ref="SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile"/>
<!-- Disallows leading backslash in use statement -->
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<!-- Prohibits uses from the same namespace -->
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
<!-- Disallow unused use statements -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- Require empty newlines before and after uses -->
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
<properties>
<property name="linesCountAfterLastUse" value="1"/>
<property name="linesCountBeforeFirstUse" value="1"/>
<property name="linesCountBetweenUseTypes" value="0"/>
</properties>
</rule>
<!-- Disallow useless alias for classes, constants and functions -->
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<!-- Disallow weak comparisons -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<!-- Checks if there is the same number of spaces after negation operator as expected -->
<rule ref="SlevomatCodingStandard.Operators.NegationOperatorSpacing"/>
<!-- Require the usage of assignment operators, eg `+=`, `.=` when possible -->
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
<!-- Disallow space after the `...` operator -->
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing">
<properties>
<property name="spacesCountAfterOperator" value="0"/>
</properties>
</rule>
<!-- Disallows direct call of __invoke() -->
<rule ref="SlevomatCodingStandard.PHP.DisallowDirectMagicInvokeCall"/>
<!-- Enforces using shorthand scalar typehint variants in phpDocs -->
<!-- Disallow argument unpacking for functions specialized by PHP VM -->
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
<!-- Requires nowdoc syntax instead of heredoc when possible -->
<rule ref="SlevomatCodingStandard.PHP.RequireNowdoc"/>
<!-- Enforces using short form of list syntax, [...] instead of list(...) -->
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<!-- Enforces using shorthand cast operators, forbids use of unset and binary cast operators -->
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<!-- Disallow `list(...)` syntax -->
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<!-- Disallow use of longhand cast operators -->
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<!-- Forbid useless parentheses -->
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<!-- Disallow useless semicolon `;` -->
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<!-- Require presence of `declare(strict_types=1)` -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="linesCountBeforeDeclare" value="1"/>
<property name="linesCountAfterDeclare" value="1"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>
<!-- Force generic type hint syntax -->
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax" />
<!-- Require use of short versions of scalar types (i.e. int instead of integer) -->
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<!-- Require the `null` type hint to be in the last position of annotations -->
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
<!-- Require `?` when default value is `null` -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<!-- Require one space between typehint and variable, require no space between nullability sign and typehint -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
<!-- Require space around colon in return types -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0"/>
</properties>
</rule>
<!-- Disallow useless `@var` for constants -->
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
<!-- Require specifying type hints for parameters -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<properties>
<!-- Requires native `string|int` type hint instead of `@param string|int` annotation -->
<property name="enableUnionTypeHint" value="true"/>
<!-- Requires native `mixed` type hint instead of `@param mixed` annotation -->
<property name="enableMixedTypeHint" value="true"/>
</properties>
</rule>
<!-- Require specifying type hints for properties -->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
<!-- Requires native `string|int` type hint instead of `@var string|int` annotation -->
<property name="enableUnionTypeHint" value="true"/>
<!-- Requires native `mixed` type hint instead of `@var mixed` annotation -->
<property name="enableMixedTypeHint" value="true"/>
</properties>
</rule>
<!-- Require specifying type hints for return statement -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<properties>
<!-- Requires native `string|int` type hint instead of `@return string|int` annotation -->
<property name="enableUnionTypeHint" value="true"/>
<!-- Requires native `mixed` type hint instead of `@return mixed` annotation -->
<property name="enableMixedTypeHint" value="true"/>
<!-- Requires native `static` type hint instead of `@return static` annotation -->
<property name="enableStaticTypeHint" value="true"/>
</properties>
</rule>
<!-- Enforce the format of union type hints -->
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="withSpaces" value="no"/>
<property name="shortNullable" value="yes"/>
</properties>
</rule>
<!-- Checks duplicate spaces anywhere -->
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
<properties>
<property name="ignoreSpacesInAnnotation" value="true"/>
<property name="ignoreSpacesInComment" value="true"/>
</properties>
</rule>
<!-- Disallow useless unreachable catch blocks -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<!-- Force \Throwable in catch statement instead of \Exception -->
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
<!-- Requires non-capturing catch when the variable with exception is not used -->
<rule ref="SlevomatCodingStandard.Exceptions.RequireNonCapturingCatch"/>
<!-- Look for duplicate assignments to a variable -->
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
<!-- Disallow useless variables -->
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
<!-- Squiz sniffs -->
<!-- Disallow spaces around square brackets -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<!-- Force array declaration structure -->
<rule ref="Squiz.Arrays.ArrayDeclaration">
<!-- Disable alignment of braces -->
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
<!-- Disable arrow alignment -->
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
<!-- Uses indentation of only single space -->
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
<!-- Checked by SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma -->
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
<!-- Allow multiple values on a single line -->
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
<!-- Disable alignment of values with opening brace -->
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
<!-- Allow multi-line array contains a single value; -->
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
</rule>
<!-- Disallow class being in a file with different name -->
<rule ref="Squiz.Classes.ClassFileName"/>
<!-- Force `self::` for self-reference, force lower-case self, forbid spaces around `::` -->
<rule ref="Squiz.Classes.SelfMemberReference"/>
<!-- Force phpDoc alignment -->
<rule ref="Squiz.Commenting.DocCommentAlignment">
<!-- Allow extra spaces after star, i.e. for indented annotations -->
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar"/>
</rule>
<!-- Force rules for function phpDoc -->
<rule ref="Squiz.Commenting.FunctionComment">
<!-- Allow `@throws` without description -->
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
<!-- Does not work properly with PHP 7 / short-named types -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
<!-- Does not support collections, i.e. `string[]` -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
<!-- Forces incorrect types -->
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
<!-- Breaks with compound return types, i.e. `string|null` -->
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturnNotVoid"/>
<!-- Breaks when all params are not documented -->
<exclude name="Squiz.Commenting.FunctionComment.InvalidTypeHint"/>
<!-- Doc comment is not required for every method -->
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
<!-- Do not require comments for `@param` -->
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<!-- Do not require `@param` for all parameters -->
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
<!-- Do not require `@return` for void methods -->
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
<!-- Comments don't have to be sentences -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<!-- Comments don't have to be sentences -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
<!-- Breaks when all params are not documented -->
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
<!-- Doesn't respect inheritance -->
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
<!-- Doesn't work with self as typehint -->
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
<!-- Doesn't work with self as typehint -->
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
</rule>
<!-- Disallow `AND` and `OR`, require `&&` and `||` -->
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
<!-- Disallow `global` -->
<rule ref="Squiz.PHP.GlobalKeyword"/>
<!-- Disallow functions inside functions -->
<rule ref="Squiz.PHP.InnerFunctions"/>
<!-- Require PHP function calls in lowercase -->
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<!-- Disallow dead code -->
<rule ref="Squiz.PHP.NonExecutableCode"/>
<!-- Disallow `$this` inside static function -->
<rule ref="Squiz.Scope.StaticThisUsage"/>
<!-- Force whitespace before and after concatenation -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Disallow strings in `"` unless necessary -->
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<message>Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead</message>
</rule>
<!-- Disallow braces around string in `echo` -->
<rule ref="Squiz.Strings.EchoedStrings"/>
<!-- Disallow spaces in type casts -->
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<!-- Disallow blank line after function opening brace -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- Require space after language constructs -->
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
<!-- Require space around logical operators -->
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<!-- Disallow spaces around `->` operator -->
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Disallow spaces before semicolon `;` -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- Disallow superfluous whitespaces -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<!-- Turned on by PSR2, turning back off -->
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<!-- Turned off by PSR2, turning back on -->
<severity>5</severity>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
<exclude-pattern>src/StdoutMessageLogger.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
<exclude-pattern>src/Atn/Transitions/AbstractPredicateTransition.php</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
<exclude-pattern>src/Recognizer.php</exclude-pattern>
</rule>
<file>src</file>
</ruleset>