-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
243 lines (193 loc) · 10.9 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
243 lines (193 loc) · 10.9 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<ruleset
name="HBPro 2.0 coding standard"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<description>Coding standard</description>
<file>bin/</file>
<file>src/</file>
<file>tests/</file>
<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="encoding" value="utf-8"/>
<config name="SlevomatStandardPath" value="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml"/>
<!-- PSR1, PSR2, RSR12 rules ========================================== -->
<rule ref="PSR1.Classes.ClassDeclaration"/>
<rule ref="PSR1.Files.SideEffects"/>
<rule ref="PSR2">
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
</rule>
<rule ref="PSR12"/>
<!-- Generic rules ==================================================== -->
<!-- Forbid dump functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="dump" value="null"/>
<element key="var_dump" value="null"/>
<element key="die" value="null"/>
<element key="exit" value="null"/>
<element key="dd" value="null"/>
</property>
</properties>
</rule>
<!-- Force whitespace after a type cast -->
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<!-- Exclude directories and files from check length of line. -->
<rule ref="Generic.Files.LineLength">
<exclude-pattern>src/Migrations</exclude-pattern>
<exclude-pattern>config/bundles.php</exclude-pattern>
</rule>
<!-- Squiz rules ====================================================== -->
<!-- Forbid blank line after function opening brace -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- Forbid spaces around square brackets -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<!-- Force array declaration structure -->
<rule ref="Squiz.Arrays.ArrayDeclaration">
<!-- Disable arrow alignment -->
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
<!-- Uses indentation of only single space -->
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
<!-- Allow multiple values on a single line -->
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
<!-- Allow single value on a multiple line -->
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
<!-- Allow associative arrays with unspecified keys -->
<exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/>
<!-- Disable alignment of braces -->
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
<!-- Disable alignment of values with opening brace -->
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
<!-- Checked by SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma -->
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
</rule>
<!-- Forbid spaces before semicolon `;` -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- Disable errors "Blank line found at start/end of control structure" -->
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing">
<!-- Disable error "Blank line found at start of control structure" -->
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
<!-- "Blank line found at end of control structure" -->
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
</rule>
<!-- Disable error "Expected 0 blank lines after opening function brace" -->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace">
<exclude name="Squiz.WhiteSpace.FunctionOpeningBraceSpace.SpacingAfter"/>
</rule>
<!-- Disabling the rule that forbids empty lines after a multi-line function declaration for constructor property promotion -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.EmptyLine">
<exclude-pattern>*</exclude-pattern>
</rule>
<!-- SlevomatCodingStandard rules ===================================== -->
<!-- Forbid duplicate spaces -->
<rule ref="SlevomatCodingStandard.Whitespaces.DuplicateSpaces">
<properties>
<!-- To disable warnings on annotation swagger in controllers.
In annotations to controllers, alignment with problems is necessary,
otherwise the annotation becomes difficult to read -->
<property name="ignoreSpacesInAnnotation" value="true"/>
</properties>
</rule>
<!-- Forbid unused use statements -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<!-- Allow search unused namespaces in annotations -->
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- Forbid using absolute class name references -->
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
<properties>
<property name="searchAnnotations" value="true"/>
<property name="allowFullyQualifiedExceptions" value="false"/>
<property name="allowFullyQualifiedNameForCollidingClasses" value="false"/>
<property name="allowFullyQualifiedNameForCollidingFunctions" value="false"/>
<property name="allowFullyQualifiedNameForCollidingConstants" value="false"/>
<property name="allowFullyQualifiedGlobalClasses" value="false"/>
<property name="allowFullyQualifiedGlobalFunctions" value="false"/>
<property name="allowFullyQualifiedGlobalConstants" value="false"/>
<property name="allowFallbackGlobalFunctions" value="false"/>
<property name="allowFallbackGlobalConstants" value="false"/>
<property name="allowPartialUses" value="true"/>
</properties>
<exclude-pattern>*/tests/_helpers/</exclude-pattern>
</rule>
<!-- Enforces one configurable number of lines after opening class/interface/trait brace and one empty line before the closing brace. -->
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<properties>
<property name="linesCountAfterOpeningBrace" value="0"/>
<property name="linesCountBeforeClosingBrace" value="0"/>
</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>
<!-- Checks declaration of arrow functions. -->
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration"/>
<!-- Checks whether the nullablity ? symbol is present before each nullable and optional parameter (which are marked as = null). -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<!-- Checks for missing parameter typehints in case they can be declared natively. -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Checks for missing property typehints in case they can be declared natively. -->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Checks for missing return typehints in case they can be declared natively. -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Enforces consistent formatting of return typehints. -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<!-- Checks that there's a single space between a typehint and a parameter name. -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<!-- 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"/>
<!-- Reports documentation comments containing only {@inheritDoc} annotation because inheritance is automatic and it's not needed to use a special annotation for it. -->
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
<!-- Check Yoda conditions - switching operands around comparison operators. -->
<rule ref="SlevomatCodingStandard.ControlStructures.RequireYodaComparison"/>
<!-- This sniff finds unreachable catch blocks. -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<!-- 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"/>
<!-- Requires nowdoc syntax instead of heredoc when possible. -->
<rule ref="SlevomatCodingStandard.PHP.RequireNowdoc"/>
<!-- Requires comments with single-line content to be written as multi-liners. -->
<rule ref="SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment"/>
<!-- Requires the class to be declared either as abstract or as final. -->
<rule ref="SlevomatCodingStandard.Classes.RequireAbstractOrFinal"/>
<!-- Checks format of union type hints. -->
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="withSpaces" value="no"/>
</properties>
</rule>
<!-- Checks whitespace in single line array declarations (whitespace between brackets, around commas, ...). -->
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace">
<properties>
<property name="spacesAroundBrackets" value="0"/>
</properties>
</rule>
<!-- StrictTypes declaration is required -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>
</ruleset>