-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml.dist
347 lines (300 loc) · 15.3 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
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Charcoal">
<description>Charcoal Coding Standard</description>
<arg name="encoding" value="utf-8" />
<config name="show_progress" value="1" />
<config name="ignore_warnings_on_exit" value="1" />
<config name="php_version" value="50630" />
<rule ref="PSR2">
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
</rule>
<!-- Array Sniffs -->
<!-- Ensures short-array notation. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!-- Ensures there are no spaces around array brackets -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
<!-- Ensures array declaration is standard. Disabled because of weird spacing requirement. -->
<!--<rule ref="Squiz.Arrays.ArrayDeclaration" />-->
<!-- Classes Sniffs -->
<!-- Classes with duplicate names are not allowed -->
<rule ref="Generic.Classes.DuplicateClassName" />
<!-- Class declaration should have the opening brackend on a new line -->
<rule ref="PEAR.Classes.ClassDeclaration" />
<!-- Checks the declaration of the class and its inheritance is correct -->
<rule ref="Squiz.Classes.ClassDeclaration" />
<!-- Tests that the file name and the name of the class contained within the file match -->
<rule ref="Squiz.Classes.ClassFileName" />
<!-- All classes keywords should be lowercase -->
<rule ref="Squiz.Classes.LowercaseClassKeywords" />
<!-- Tests self member references -->
<rule ref="Squiz.Classes.SelfMemberReference" />
<!-- Test class names are camel-cased properly -->
<rule ref="Squiz.Classes.ValidClassName" />
<!-- Code Analysis Sniffs -->
<!-- Do not allow empty if, else or case -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<!-- Simple for loops (for(;true;){}) should be while -->
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
<!-- Do not allow function in for(...) loops. Use a temporary variable to store the result instead -->
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall" />
<!-- Do not allow nested loops to share the same incrementer -->
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
<!-- @todo Doc me -->
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
<!-- If a class is declared as being final, it is redundant to redeclare methods as final -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
<!-- Unused function parameter are disouraged -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
<!-- Detects unnecessary overridden methods that simply call their parent -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<!-- This sniff class detects empty statement. -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<!-- Commenting Sniffs -->
<!-- Detect "fixme" comments and warn -->
<rule ref="Generic.Commenting.Fixme" />
<!-- Detect "todo" comments and warn -->
<!--<rule ref="Generic.Commenting.Todo" />-->
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.FileComment.Missing" />-->
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.ClassComment" />-->
<!-- @todo Doc me -->
<!--<rule ref="PEAR.Commenting.FunctionComment.Missing" />-->
<!-- Block comments should be used appropriately -->
<!--<rule ref="Squiz.Commenting.BlockComment" />-->
<!-- Class comment blocks -->
<rule ref="Squiz.Commenting.ClassComment" />
<!-- Tests that the stars in a doc comment align correctly. -->
<rule ref="Squiz.Commenting.DocCommentAlignment" />
<!-- Ensures CATCH clause must at least have a comment -->
<rule ref="Squiz.Commenting.EmptyCatchComment" />
<!-- File comment blocks -->
<!--<rule ref="Squiz.Commenting.FileComment" />-->
<!-- Function comment blocks -->
<rule ref="Squiz.Commenting.FunctionComment" />
<!-- Do not test scalar typehint (php-7 only feature) -->
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
<severity>0</severity>
</rule>
<!-- Verifies that a @throws tag exists for a function that throws exceptions -->
<rule ref="Squiz.Commenting.FunctionCommentThrowTag" />
<!-- Checks that there is adequate spacing between comments -->
<!--<rule ref="Squiz.Commenting.InlineComment" />-->
<!-- @todo doc me -->
<!--<rule ref="Squiz.Commenting.LongConditionClosingComment" />-->
<!-- Checks to ensure that there are no comments after statements (on same line, after ;) -->
<rule ref="Squiz.Commenting.PostStatementComment" />
<!-- Variable commenting rules -->
<rule ref="Squiz.Commenting.VariableComment">
<exclude name="Squiz.Commenting.VariableComment.DuplicateVar"/>
<exclude name="Squiz.Commenting.VariableComment.Missing"/>
</rule>
<!-- Control Structures Sniffs -->
<!-- Inline controls (IF, ELSE, FOR, WHILE) must have brackets -->
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<!-- Controls signature, such as spacing. IF (expr) {... -->
<rule ref="Squiz.ControlStructures.ControlSignature" />
<!-- Usage of ELSEIF not allowed. The ELSE and the IF should be separated by a space. Incompatible with PSR -->
<!--<rule ref="Squiz.ControlStructures.ElseIfDeclaration" />-->
<!-- Verifies that there is a space between each condition of FOREACH loops -->
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration" />
<!-- Verifies that there is a space between each condition of FOR loops -->
<rule ref="Squiz.ControlStructures.ForLoopDeclaration" />
<!-- Tests the spacing of shorthand IF statements -->
<!-- <rule ref="Squiz.ControlStructures.InlineIfDeclaration" />-->
<!-- Ensures all control structure keywords are lowercase -->
<rule ref="Squiz.ControlStructures.LowercaseDeclaration" />
<!--<rule ref="Squiz.ControlStructures.SwitchDeclaration" />-->
<!-- Files Sniffs -->
<!-- A simple sniff for detecting BOMs that may corrupt application work -->
<rule ref="Generic.Files.ByteOrderMark" />
<!-- Ensures all files end with a newline character -->
<rule ref="Generic.Files.EndFileNewline" />
<!-- Ensures all files do NOT end with a newline character. This is incompatible with the previous rule. -->
<!--<rule ref="Generic.Files.EndFileNoNewline" />-->
<!-- Do not allow HTML in PHP files -->
<!--Generic.Files_InlineHTMLSniff-->
<!-- All line endings are standardized to "\n" -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n" />
</properties>
</rule>
<!-- Make sure all files are a certain max length -->
<!--<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>-->
<!-- Checks that all file names are lowercased. Incompatible with PSR. -->
<!--<rule ref="Generic.Files.LowercasedFilename" />-->
<!-- Formatting Sniffs -->
<!-- Do not allow multiple PHP statements (;) on a same line -->
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
<!-- Make sure all adjacent assigments are properly aligned, for the extra-pedantic in you -->
<!--<rule ref="Generic.Formatting.MultipleStatementAlignment" />-->
<!-- Ensure there are no spaces after a typecast Ex: (array)$x -->
<rule ref="Generic.Formatting.NoSpaceAfterCast" />
<!-- Ensure there *is* a space after a typecase. Incompatible with the previous rule -->
<!--<rule ref="Generic.Formatting.SpaceAfterCast" />-->
<!-- Tests that all arithmetic operations are bracketed. -->
<rule ref="Squiz.Formatting.OperatorBracket" />
<!-- Functions Sniffs -->
<!-- Ensures that variables are not passed by reference when calling a function -->
<rule ref="Generic.Functions.CallTimePassByReference" />
<!-- Spaces are required after every commas in function calls -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<!-- Opening braces should be on a new line for functions -->
<!--<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>-->
<!-- Opening braces should be on the same line for functions. Incompatible with previous rule -->
<!--<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />-->
<!-- Checks that arguments in function declarations are spaced correctly. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!-- @todo doc me -->
<rule ref="Squiz.Functions.FunctionDeclaration" />
<!-- @todo doc me -->
<rule ref="Squiz.Functions.FunctionDuplicateArgument" />
<!-- Completely disallow global Functions -->
<rule ref="Squiz.Functions.GlobalFunction" />
<!-- @todo doc me -->
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
<!-- Ensure single and multi-line function declarations are defined correctly -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction">
<!-- This check is disabled; it breaks lambda functions -->
<severity>0></severity>
</rule>
<rule ref="PEAR.Functions.ValidDefaultValue" />
<!-- Metrics Sniffs -->
<!--
Generic.Metrics_CyclomaticComplexity
complexity
absoluteComplexity
Generic.Metrics_NestingLevel
nestingLevel
absoluteNestingLevel
-->
<!-- Naming Conventions Sniffs -->
<!-- @todo Doc -->
<!--<rule ref="Generic.NamingConventions.CamelCapsFunctionName" /> -->
<!-- Constructor should be in PHP5 mode (__construct) -->
<rule ref="Generic.NamingConventions.ConstructorName" />
<!-- All constants should be uppercase -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<!-- Objects Sniffs -->
<!-- Ensures objects are assigned to a variable when instantiated. -->
<rule ref="Squiz.Objects.ObjectInstantiation">
<exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned" />
</rule>
<!-- Operators Sniffs -->
<!-- Force === operator instead of implicit true if(x) or false if(!x) -->
<!--<rule ref="Squiz.Operators.ComparisonOperatorUsage" />-->
<!-- Make sure all instances of ++ operators makes sense -->
<rule ref="Squiz.Operators.IncrementDecrementUsage" />
<!-- Disallow "and" and "or". Use && and || instead -->
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<!-- PHP Sniffs -->
<!-- Checks that the opening PHP tag is the first content in a file -->
<!--<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" />-->
<!-- Checks that open PHP tags are paired with closing tags. -->
<!--<rule ref="Generic.PHP.ClosingPHPTag" />-->
<!-- Deprecated functions are not allowed. This is a modern codebase -->
<rule ref="Generic.PHP.DeprecatedFunctions" />
<!-- Short tags are not allowed anywhere for maximum compatibility -->
<rule ref="Generic.PHP.DisallowShortOpenTag" />
<!-- Discourage unsafe functions -->
<rule ref="Generic.PHP.ForbiddenFunctions" />
<!-- TRUE, FALSE and NULL must be lowercase: true, false and null -->
<rule ref="Generic.PHP.LowerCaseConstant" />
<!-- Checks that all PHP keywords are lowercase. Disabled because of \List classes -->
<rule ref="Generic.PHP.LowerCaseKeyword" />
<!-- Don't allow code prefixed with an @ (error suppression) -->
<rule ref="Generic.PHP.NoSilencedErrors" />
<!-- Ensures the PHP_SAPI constant is used instead of php_sapi_name() -->
<rule ref="Generic.PHP.SAPIUsage" />
<!-- Checks that all uses of TRUE, FALSE and NULL are uppercase. Incompatible with LowerCaseConstant -->
<!--<rule ref="Generic.PHP.UpperCaseConstant" />-->
<!-- Warn of commented out code -->
<rule ref="Squiz.PHP.CommentedOutCode" />
<!--<rule ref="Squiz.PHP.DisallowBooleanStatement" />-->
<!-- @todo Doc me -->
<!--<rule ref="Squiz.PHP.DisallowComparisonAssignment" />-->
<!-- Disallow inline IF DISABLED -->
<!--<rule ref="Squiz.PHP.DisallowInlineIf" />-->
<rule ref="Squiz.PHP.DisallowMultipleAssignments" />
<!--<rule ref="Squiz.PHP.DisallowObEndFlush" />-->
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops" />
<!-- @todo Doc me -->
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
<property name="forbiddenFunctions" type="array" value="print_r=>null,var_dump=>null,var_export=>null" />
</properties>
</rule>
<rule ref="Squiz.PHP.EmbeddedPhp" />
<rule ref="Squiz.PHP.EmbeddedPhp.Indent">
<severity>0</severity>
</rule>
<rule ref="Squiz.PHP.Eval" />
<!-- Disallow usage of functions that should be obsolete but kept for compatibility. -->
<rule ref="Generic.PHP.ForbiddenFunctions" />
<rule ref="Squiz.PHP.GlobalKeyword" />
<rule ref="Squiz.PHP.Heredoc" />
<rule ref="Squiz.PHP.InnerFunctions" />
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<!-- Warns of code that will never be reached DISABLED-->
<rule ref="Squiz.PHP.NonExecutableCode" />
<!-- Scope Sniffs -->
<!-- Verifies that class members have scope modifiers. -->
<rule ref="Squiz.Scope.MemberVarScope" />
<!-- Verifies that class methods have scope modifiers. -->
<rule ref="Squiz.Scope.MethodScope" />
<!-- Make sure $this is not used in static methods -->
<rule ref="Squiz.Scope.StaticThisUsage" />
<!-- Strings Sniffs -->
<!-- Use one string instead of concatenating 2 strings together -->
<rule ref="Generic.Strings.UnnecessaryStringConcat">
<properties>
<property name="allowMultiline" value="true"/>
</properties>
</rule>
<!-- Makes sure there are no spaces between the concatenation operator (.) the strings -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!-- Makes sure that any use of Double Quotes ("") are warranted. -->
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
<!-- Makes sure that any strings that are "echoed" are not enclosed in brackets -->
<rule ref="Squiz.Strings.EchoedStrings" />
<!-- Version Control Sniffs -->
<!-- Tests that the correct Subversion properties are set -->
<rule ref="Generic.VersionControl.SubversionProperties" />
<!-- White Space Sniffs -->
<!-- Throws errors if spaces are used for indentation -->
<!--<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />-->
<!-- Throws errors if tabs are used for indentation -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<!-- Checks that control structures are structured correctly -->
<!--<rule ref="Generic.Whitespace.ScopeIndent" />-->
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity>
</rule>
</ruleset>