-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
350 lines (271 loc) · 15.7 KB
/
phpcs.xml
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
<?xml version="1.0"?>
<ruleset name="Seveny Media">
<description>Seveny Media coding standard.</description>
<!-- Changing default encoding (ISO-8859-1) to UTF-8 -->
<config name="encoding" value="utf-8"/>
<!-- Apply CS only on listed directories -->
<file>./src</file>
<file>./tests</file>
<!-- Set default ignore paths -->
<!--<exclude-pattern>./_ide_helper.php</exclude-pattern>-->
<!--<exclude-pattern>./resources/views</exclude-pattern>-->
<!--<exclude-pattern>./storage</exclude-pattern>-->
<!--<exclude-pattern>./vendor</exclude-pattern>-->
<exclude-pattern>./bootstrap/cache/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Give output some nice colors -->
<arg name="colors"/>
<!-- Only validate PHP files -->
<arg name="extensions" value="php"/>
<!-- Print Sniff in all reports -->
<arg value="s"/>
<!-- 2. General -->
<!-- 2.1 Basic Coding Standard -->
<!-- Include the whole PSR-1 standard -->
<rule ref="PSR1"/>
<!-- 2.2 Files -->
<!-- All PHP files MUST use the Unix LF (linefeed) line ending. -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!--<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">-->
<!--<exclude-pattern>./bootstrap/autoload.php</exclude-pattern>-->
<!--</rule>-->
<!-- All PHP files MUST end with a single blank line. -->
<!-- checked in Files/EndFileNewlineSniff -->
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<rule ref="Zend.Files.ClosingTag"/>
<!-- 2.3 Lines -->
<!-- The soft limit on line length MUST be 120 characters; automated style checkers MUST warn but MUST NOT error at the soft limit. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="180"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!-- WhiteSpace rules:
Cast statements MUST NOT contain spaces
Control structures SHOULD have correct spacing around brackets
There SHOULD be one empty line after function close brace
There SHOULD NOT be an empty line after function open brace
There SHOULD be separation between methods and functions
There SHOULD be one space after language constructs
There SHOULD be a space around logical operators
There SHOULD be spacing around operators
Closing brace SHOULD be aligned correctly with opening brace
Scope keyword (ie. private, protected, public) SHOULD be followed by one space
There SHOULD NOT be whitespace around a semicolon
There MUST NOT be trailing whitespace at the end of non-blank lines.
-->
<rule ref="Squiz.WhiteSpace">
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose"/>
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose"/>
<exclude name="Squiz.WhiteSpace.MemberVarSpacing"/>
<!-- Should be enabled, but raises issues with Eloquent -->
<exclude name="Squiz.WhiteSpace.ObjectOperatorSpacing"/>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<exclude-pattern>*/helpers.php</exclude-pattern>
<properties>
<property name="spacing" value="1"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<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>
<!-- There MUST NOT be more than one statement per line. -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!-- 2.4 Indenting -->
<!-- Code MUST use one tab indent, and MUST NOT use spaces for indenting. -->
<!--<rule ref="Laravel.Tabs.DisallowWhitespaceIndent"/>-->
<!-- Code MUST use space indent, and MUST NOT use tabs for indenting. -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- 2.5 Keywords and True/False/Null -->
<!-- PHP keywords MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<!-- The PHP constants true, false, and null MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseConstant"/>
<!-- 2.6. Naming Conventions -->
<!-- Functions and variables must be correctly named using camel caps and no underscores -->
<rule ref="Squiz.NamingConventions">
<exclude-pattern>*/helpers.php</exclude-pattern>
<exclude name="Squiz.NamingConventions.ValidFunctionName.PrivateNoUnderscore"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
</rule>
<rule ref="Zend.NamingConventions">
<exclude name="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore"/>
<exclude name="Zend.NamingConventions.ValidVariableName.ProtectedNoUnderscore"/>
</rule>
<!-- 2.7. PHP -->
<!-- Usage of deprecated methods is discouraged. -->
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<!-- Do not allow suppression of error using @ -->
<rule ref="Generic.PHP.NoSilencedErrors"/>
<!-- Debug functions MUST NOT be used in production code -->
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
<!-- Function eval() MUST NOT be used in production code -->
<rule ref="Squiz.PHP.Eval"/>
<!-- Discourage use of alias functions -->
<!--<rule ref="Squiz.PHP.ForbiddenFunctions"/>-->
<!-- "global" keyword MUST NOT be used -->
<rule ref="Squiz.PHP.GlobalKeyword"/>
<!-- There MAY NOT BE functions defined within functions -->
<rule ref="Squiz.PHP.InnerFunctions"/>
<!-- Avoid calls to internal method using capitals (ie. ARRAY_FLIP()) -->
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<!-- Warns about code that can never be executed (ie. after a return) -->
<rule ref="Squiz.PHP.NonExecutableCode"/>
<!-- Operator rules:
Strict operators MUST be used
Increment and decrement MUST be used when possible
Logical operators MUST NOT be used -->
<rule ref="Squiz.Operators"/>
<rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
<type>warning</type>
</rule>
<!-- 2.8. Comments -->
<!-- Throw a warning about todo's -->
<rule ref="Generic.Commenting.Todo"/>
<!-- 3. Namespace and Use Declarations -->
<!-- When present, there MUST be one blank line after the namespace declaration. -->
<!-- checked in Namespaces/NamespaceDeclarationSniff -->
<!-- When present, all use declarations MUST go after the namespace declaration.
There MUST be one use keyword per declaration.
There MUST be one blank line after the use block. -->
<!-- checked in Namespaces/UseDeclarationSniff -->
<!-- Files in /database may omit namespace -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>./database/*</exclude-pattern>
</rule>
<!-- 4. Classes, Properties, and Methods -->
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<!-- 4.1. Extends and Implements -->
<!-- The extends and implements keywords MUST be declared on the same line as the class name.
The opening brace for the class go MUST go on its own line; the closing brace for the class MUST go on the next line after the body.
Lists of implements MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item
in the list MUST be on the next line, and there MUST be only one interface per line. -->
<!-- checked in Classes/ClassDeclarationSniff -->
<!-- 4.2. Properties -->
<!-- Visibility MUST be declared on all properties.
The var keyword MUST NOT be used to declare a property.
There MUST NOT be more than one property declared per statement.
Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
<!-- checked in Classes/PropertyDeclarationSniff -->
<!-- 4.3 Methods -->
<!-- Visibility MUST be declared on all methods. -->
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<!-- Method names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. -->
<!-- checked in Methods/MethodDeclarationSniff -->
<!-- Method names MUST NOT be declared with a space after the method name. The opening brace MUST go on its own line, and the closing brace
MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space
before the closing parenthesis. -->
<!--<rule ref="Laravel.Functions.FunctionDeclaration"/>-->
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
<!-- 4.4 Method Arguments -->
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!--<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">-->
<!--<severity>0</severity>-->
<!--</rule>-->
<!-- Method arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list
MUST be on the next line, and there MUST be only one argument per line. When the argument list is split across multiple lines, the
closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
<!--<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>-->
<!-- 4.5 abstract, final, and static -->
<!-- When present, the abstract and final declarations MUST precede the visibility declaration.
When present, the static declaration MUST come after the visibility declaration. -->
<!-- checked in Methods/MethodDeclarationSniff -->
<!-- 4.6 Method and Function Calls -->
<!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there
MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list,
there MUST NOT be a space before each comma, and there MUST be one space after each comma.
Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list
MUST be on the next line, and there MUST be only one argument per line. -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<!-- There MUST NOT be a space after function opening bracket -->
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket"/>
<!-- There MUST NOT be a space after function closing bracket -->
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/>
<!-- 5. Control Structures -->
<!-- The general style rules for control structures are as follows:
There MUST be one space after the control structure keyword
There MUST NOT be a space after the opening parenthesis
There MUST NOT be a space before the closing parenthesis
There MUST be one space between the closing parenthesis and the opening brace
The structure body MUST be indented once
The closing brace MUST be on the next line after the body -->
<!--<rule ref="Laravel.ControlStructures.ControlSignature">-->
<!--<properties>-->
<!--<property name="ignoreComments" value="true"/>-->
<!--</properties>-->
<!--</rule>-->
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<!-- The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!-- 5.1. if, elseif, else -->
<!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration">
<type>error</type>
</rule>
<!-- 5.2. switch, case -->
<!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keyword) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. -->
<rule ref="Squiz.ControlStructures.SwitchDeclaration">
<exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent"/>
<exclude name="Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak"/>
</rule>
<!-- 5.3. array -->
<!-- Arrays MUST be declared using short syntax ([] instead of array()) -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Empty arrays SHOULD NOT hold spaces -->
<rule ref="Squiz.Arrays.ArrayDeclaration.SpaceInEmptyArray"/>
<!-- Last array entry MUST be suffixed with a comma -->
<rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
<!-- 5.4. string -->
<!-- String rules:
Concatenation operators SHOULD NOT be surrounded by spaces
Single quoted MUST be used when possible
"Echoed" strings SHOULD NOT be enclosed in brackets
-->
<rule ref="Squiz.Strings">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
</rule>
<!-- Strings MUST NOT be unnecessary concatenated -->
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<!-- 6. Closures -->
<!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword.
The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body.
There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list.
In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma.
Closure arguments with default values MUST go at the end of the argument list.
Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line.
When the ending list (whether or arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
<!-- checked in Squiz.Functions.MultiLineFunctionDeclaration -->
</ruleset>