-
Notifications
You must be signed in to change notification settings - Fork 48
/
phpcs.xml.dist
254 lines (202 loc) · 10.8 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="colors"/>
<arg value="p"/>
<arg value="s"/>
<file>app</file>
<file>bin</file>
<file>src</file>
<file>tests</file>
<!-- PSR-12 coding standard -->
<rule ref="PSR12"/>
<!-- Generic rules not included in PSR-12 -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement">
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
</rule>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.Files.InlineHTML"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0"/>
</properties>
</rule>
<rule ref="Generic.PHP.BacktickOperator"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.DisallowShortOpenTag">
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
</rule>
<rule ref="Generic.PHP.DiscourageGoto"/>
<rule ref="Generic.PHP.SAPIUsage"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true"/>
</properties>
</rule>
<!-- Disallows implicit array creation -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<!-- Array must have keys specified for either all or none of the values -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed"/>
<!-- Enforces reasonable end bracket placement for multi-line arrays -->
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
<!-- Checks whitespace in single line array declarations -->
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace">
<properties>
<property name="enableEmptyArrayCheck" value="true"/>
</properties>
</rule>
<!-- This sniff enforces trailing commas in multi-line arrays -->
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<!-- Disallows using public properties -->
<rule ref="SlevomatCodingStandard.Classes.ForbiddenPublicProperty"/>
<!-- Enforces no empty line before/after opening class/interface/trait brace -->
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0"/>
<property name="linesCountBeforeClosingBrace" value="0"/>
</properties>
</rule>
<!-- Checks that there is exactly one blank line between different class members -->
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing"/>
<!-- Checks that there is a certain number of blank lines between constants -->
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing"/>
<!-- Checks that there is a certain number of blank lines between properties -->
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing"/>
<!-- Checks that there is exactly one blank line between class methods -->
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing"/>
<!-- Enforces configurable number of lines before first use, after last use and between two use statements -->
<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
<properties>
<property name="linesCountBeforeFirstUseWhenFirstInClass" value="0"/>
<property name="linesCountAfterLastUseWhenLastInClass" value="0"/>
</properties>
</rule>
<!-- Requires use of constructor property promotion -->
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/>
<!-- Expected PHPDoc format -->
<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="@inheritdoc"/>
<element value="@internal,@deprecated,@var,@param,@return,@throws"/>
</property>
</properties>
</rule>
<!-- Reports invalid inline phpDocs with @var -->
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
<!-- Forbidden PHPDoc annotations -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@author"/>
<element value="@category"/>
<element value="@copyright"/>
<element value="@created"/>
<element value="@license"/>
<element value="@package"/>
<element value="@subpackage"/>
<element value="@version"/>
<element value="@expectedException"/>
<element value="@expectedExceptionCode"/>
<element value="@expectedExceptionMessage"/>
<element value="@expectedExceptionMessageRegExp"/>
</property>
</properties>
</rule>
<!-- Reports empty comments -->
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
<!-- Disallows assignments in if, elseif and do-while loop conditions -->
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
<!-- Yoda conditions decrease code comprehensibility and readability -->
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
<!-- Requires use of null coalesce operator when possible -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<!-- This sniff finds unreachable catch blocks -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<!-- Checks arrow function declaration -->
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration"/>
<!-- Checks whether uses at the top of a file are alphabetically sorted -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
<!-- Looks for unused imports from other namespaces -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- Looks for use alias that is same as unqualified name -->
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<!-- Disallows direct call of __invoke() -->
<rule ref="SlevomatCodingStandard.PHP.DisallowDirectMagicInvokeCall"/>
<!-- Reports empty functions body and requires at least a comment inside -->
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
<!-- This sniff disallows usage of named arguments -->
<rule ref="SlevomatCodingStandard.Functions.DisallowNamedArguments"/>
<!-- Enforces using short form of list syntax -->
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
<!-- Enforces using shorthand cast operators -->
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<!-- Looks for useless parentheses -->
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<!-- Looks for useless semicolons -->
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<!-- Disallows using loose `==` and `!=` comparison operators. Use `===` and `!==` instead -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<!-- Disallows spaces after negation operator -->
<rule ref="SlevomatCodingStandard.Operators.NegationOperatorSpacing"/>
<!-- Disallows use of super global variables -->
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable"/>
<!-- Looks for duplicate assignments to a variable -->
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
<!-- Looks for unused variables -->
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable"/>
<!-- Looks for useless variables -->
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
<!-- Enforces having declare(strict_types=1) at the top of each PHP file -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="declareOnFirstLine" value="false"/>
<property name="linesCountBeforeDeclare" value="1"/>
<property name="linesCountAfterDeclare" value="1"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>
<!-- Enforces using shorthand scalar typehints -->
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<!-- Enforces null type hint on last position in annotations -->
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
<!-- Checks whether the nullablity ? symbol is present before each nullable and optional parameter -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<!-- Checks for missing property typehints -->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>
<!-- Checks for missing parameter typehints -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>
<!-- Checks for missing return typehints -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>
<!-- Checks format of union type hints (only enabled if php >= 8.0) -->
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="withSpaces" value="no"/>
<property name="nullPosition" value="last"/>
</properties>
</rule>
<!-- Reports useless @var annotation for constants because the type of constant is always clear -->
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
<!-- Checks duplicate spaces anywhere because there aren't sniffs for every part of code to check formatting -->
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces"/>
</ruleset>