-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml
More file actions
202 lines (154 loc) · 8.25 KB
/
phpcs.xml
File metadata and controls
202 lines (154 loc) · 8.25 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
<?xml version="1.0"?>
<ruleset name="My Standards">
<config name="installed_paths" value="vendor/slevomat/coding-standard"/>
<!-- File configuration -->
<ini name="memory_limit" value="128M"/>
<arg name="extensions" value="php"/>
<exclude-pattern>*/cache/*</exclude-pattern>
<exclude-pattern>*/autoload.php</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Use PSR12 as the base config -->
<rule ref="PSR12">
<!-- Constants should be camel case. -->
<exclude name="Generic.NamingConventions.UpperCaseConstantName"/>
<!-- Exclude to behave correctly on switches -->
<exclude name="Generic.WhiteSpace.ScopeIndent"/>
</rule>
<!-- Lines can be 120 chars long, but never show errors -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="300"/>
</properties>
<exclude-pattern>*/Schema/*</exclude-pattern>
</rule>
<!-- Short form of type keywords MUST be used i.e. bool instead of boolean, int instead of integer etc. -->
<rule ref="PSR12.Keywords.ShortFormTypeKeywords"/>
<!-- Validate DOC Comments -->
<rule ref="Squiz.Commenting.FunctionComment">
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed"/>
<!-- Exclude sub-rules that strictly demand long names like 'integer' or 'boolean' -->
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
</rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
<rule ref="Squiz.Commenting.ClassComment"/>
<!-- There can be more than one space after property type declaration to align the properties -->
<rule ref="PSR2.Classes.PropertyDeclaration.SpacingAfterType">
<severity>0</severity>
</rule>
<!-- Function opening brace MUST be on the same line as the function declaration -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
<severity>0</severity>
</rule>
<!-- Separate header blocks with a single blank line. -->
<rule ref="PSR12.Files.FileHeader">
<exclude name="PSR12.Files.FileHeader.SpacingAfterTagBlock"/>
<exclude name="PSR12.Files.FileHeader.SpacingInsideUseBlock"/>
</rule>
<rule ref="PSR12.Files.FileHeader.SpacingAfterNamespaceBlock" />
<!-- Opening brace of a class MUST be on same line as the definition -->
<rule ref="PSR2.Classes.ClassDeclaration.OpenBraceNewLine">
<severity>0</severity>
</rule>
<!-- There can be a space at the start of a class body -->
<rule ref="PSR12.Classes.OpeningBraceSpace">
<severity>0</severity>
</rule>
<!-- The first expression of a multi-line control structure must be on the line of the opening parenthesis -->
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
<rule ref="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine">
<severity>0</severity>
</rule>
<!-- A file SHOULD declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it SHOULD execute logic with side effects, but SHOULD NOT do both. -->
<rule ref="PSR1.Files.SideEffects"/>
<!-- There must be one blank line after the namespace declaration. -->
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<!-- Each use declaration must contain only one namespace and must come after the first namespace declaration. There should be one blank line after the final use statement. -->
<rule ref="PSR2.Namespaces.UseDeclaration"/>
<!-- Duplicate class name check -->
<rule ref="Generic.Classes.DuplicateClassName"/>
<!-- Disallow allow empty statements -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<!-- For loops that have only a second expression (the condition) should be converted to while loops. -->
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<!-- For loops should not call functions inside the test for the loop when they can be computed beforehand. -->
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
<!-- Incrementers in nested loops should use different variable names. -->
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<!-- If statements that are always evaluated should not be used. -->
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
<!-- Methods should not be declared final inside of classes that are declared final. -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<!-- It is discouraged to override a method if the overriding method only calls the parent method. -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<!-- TODO Statements should be taken care of. -->
<rule ref="Generic.Commenting.Todo"/>
<!-- FIXME Statements should be taken care of. -->
<rule ref="Generic.Commenting.Fixme"/>
<!-- There should be no space after a cast. -->
<rule ref="Generic.Formatting.SpaceAfterCast">
<properties>
<property name="spacing" value="0"/>
</properties>
</rule>
<!-- Constructors should be named __construct, not after the class. -->
<rule ref="Generic.NamingConventions.ConstructorName"/>
<!-- Deprecated functions should not be used. -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<!-- The forbidden functions sizeof() and delete() should not be used. -->
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<!-- Suppressing Errors is not allowed. -->
<rule ref="Generic.PHP.NoSilencedErrors"/>
<!-- Short array syntax must be used to define arrays. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Functions should not have a nesting level greater than 10, and should try to stay below 5. -->
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="5"/>
<property name="absoluteNestingLevel" value="10"/>
</properties>
</rule>
<!-- Functions should not have a cyclomatic complexity greater than 20, and should try to stay below a complexity of 10. -->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="100"/>
<property name="absoluteComplexity" value="100"/>
</properties>
</rule>
<!-- Switch case must have no extra indentation -->
<rule ref="PSR2.ControlStructures.SwitchDeclaration">
<properties>
<property name="indent" value="0"/>
</properties>
</rule>
<!-- Switch break must be indented 4 spaces -->
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
<severity>0</severity>
</rule>
<!-- Array rules -->
<rule ref="Squiz.Arrays.ArrayDeclaration">
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNoNewline"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/>
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
</rule>
<!-- Include short types support in DOC Comments -->
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<!-- Remove unused imports -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<!-- Disallow the use of increment and decrement operators -->
<rule ref="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators"/>
<!-- Require trailing comma in multi-line function/method call and declaration -->
<rule ref="SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration"/>
<!-- Require visibility for all class constants -->
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
</ruleset>