|
105 | 105 | <!-- Compound namespaces with a depth of more than two MUST NOT be used. -->
|
106 | 106 | <!-- checked by PSR12.Namespaces.CompoundNamespaceDepth -->
|
107 | 107 |
|
108 |
| - <!-- When wishing to declare strict types in files containing markup outside PHP opening and closing tags MUST, on the first line, include an opening PHP tag, the strict types declaration and closing tag. --> |
| 108 | + <!-- When wishing to declare strict types in files containing markup outside PHP opening and closing tags, the declaration MUST be on the first line of the file and include an opening PHP tag, the strict types declaration and closing tag. --> |
109 | 109 |
|
110 | 110 | <!-- Declare statements MUST contain no spaces and MUST be exactly declare(strict_types=1) (with an optional semi-colon terminator). -->
|
111 | 111 |
|
|
115 | 115 |
|
116 | 116 | <!-- Any closing brace MUST NOT be followed by any comment or statement on the same line. -->
|
117 | 117 |
|
118 |
| - <!-- When instantiating a new class, parenthesis MUST always be present even when there are no arguments passed to the constructor. --> |
| 118 | + <!-- When instantiating a new class, parentheses MUST always be present even when there are no arguments passed to the constructor. --> |
119 | 119 | <!-- checked by PSR12.Classes.ClassInstantiation -->
|
120 | 120 |
|
121 | 121 | <!-- 4.1 Extends and Implements -->
|
|
124 | 124 | <!-- The opening brace for the class MUST go on its own line; the closing brace for the class MUST go on the next line after the body. -->
|
125 | 125 | <!-- Opening braces MUST be on their own line and MUST NOT be preceded or followed by a blank line. -->
|
126 | 126 | <!-- Closing braces MUST be on their own line and MUST NOT be preceded by a blank line. -->
|
127 |
| - <!-- Lists of implements and extends 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. --> |
| 127 | + <!-- Lists of implements and, in the case of interfaces, extends 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. --> |
128 | 128 | <rule ref="PSR2.Classes.ClassDeclaration"/>
|
129 | 129 |
|
130 | 130 | <!-- 4.2 Using traits -->
|
131 | 131 |
|
132 | 132 | <!-- The use keyword used inside the classes to implement traits MUST be declared on the next line after the opening brace. -->
|
133 | 133 |
|
134 |
| - <!-- Each individual Trait that is imported into a class MUST be included one-per-line and each inclusion MUST have its own use import statement. --> |
| 134 | + <!-- Each individual trait that is imported into a class MUST be included one-per-line and each inclusion MUST have its own use import statement. --> |
135 | 135 |
|
136 | 136 | <!-- When the class has nothing after the use import statement, the class closing brace MUST be on the next line after the use import statement. Otherwise, it MUST have a blank line after the use import statement. -->
|
137 | 137 |
|
138 |
| - <!-- When using the insteadof and as operators they must be used as follows taking note of indentation, spacing and new lines. --> |
| 138 | + <!-- When using the insteadof and as operators they must be used as follows taking note of indentation, spacing, and new lines. --> |
139 | 139 |
|
140 | 140 | <!-- 4.3 Properties and Constants -->
|
141 | 141 |
|
|
163 | 163 | <message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
|
164 | 164 | </rule>
|
165 | 165 |
|
166 |
| - <!-- Method and function 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. --> |
| 166 | + <!-- Method and function names MUST NOT be declared with 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. --> |
167 | 167 | <rule ref="PSR2.Methods.FunctionClosingBrace"/>
|
168 | 168 | <rule ref="Squiz.Functions.FunctionDeclaration"/>
|
169 | 169 | <rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
|
170 | 170 |
|
171 |
| - <!-- 4.5 Method and function Arguments --> |
| 171 | + <!-- 4.5 Method and Function Arguments --> |
172 | 172 |
|
173 | 173 | <!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
|
174 | 174 | <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
|
187 | 187 | 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. -->
|
188 | 188 | <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
|
189 | 189 |
|
190 |
| - <!-- When you have a return type declaration present there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parentheses with no spaces between the two characters. --> |
| 190 | + <!-- When you have a return type declaration present, there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parenthesis with no spaces between the two characters. --> |
191 | 191 |
|
192 | 192 | <!-- In nullable type declarations, there MUST NOT be a space between the question mark and the type. -->
|
193 | 193 | <!-- checked by PSR12.Functions.NullableTypeDeclaration -->
|
194 | 194 |
|
195 | 195 | <!-- When using the reference operator & before an argument, there MUST NOT be a space after it. -->
|
196 | 196 |
|
197 |
| - <!-- There MUST NOT be a space between the variadic three dots and the argument name. --> |
| 197 | + <!-- There MUST NOT be a space between the variadic three dot operator and the argument name. --> |
198 | 198 |
|
199 |
| - <!-- When combining both the reference operator and the variadic three dots, there MUST NOT be any space between the two of them. --> |
| 199 | + <!-- When combining both the reference operator and the variadic three dot operator, there MUST NOT be any space between the two of them. --> |
200 | 200 |
|
201 | 201 | <!-- 4.6 abstract, final, and static -->
|
202 | 202 |
|
|
225 | 225 | There MUST NOT be a space before the closing parenthesis
|
226 | 226 | There MUST be one space between the closing parenthesis and the opening brace
|
227 | 227 | The structure body MUST be indented once
|
| 228 | + The body MUST be on the next line after the opening brace |
228 | 229 | The closing brace MUST be on the next line after the body
|
229 | 230 | 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. -->
|
230 | 231 | <rule ref="Squiz.ControlStructures.ControlSignature"/>
|
|
270 | 271 |
|
271 | 272 | <!-- 5.3.2 do while -->
|
272 | 273 |
|
273 |
| - <!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. --> |
| 274 | + <!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. --> |
274 | 275 |
|
275 | 276 | <!-- 5.4 for -->
|
276 | 277 |
|
|
282 | 283 |
|
283 | 284 | <!-- 6. Operators -->
|
284 | 285 |
|
285 |
| - <!-- All binary and ternary operators MUST be preceded and followed by at least one space; multiple spaces MAY be used for readability purpose. This includes all arithmetic, comparison, assignment, bitwise, logical (excluding ! which is unary), string concatenation, type operators, trait operators (insteadof and as), and the single pipe operator (e.g. ExceptionType1 | ExceptionType2 $e). --> |
286 |
| - <!-- checked by PSR12.Operators.OperatorSpacing --> |
| 286 | + <!-- When space is permitted around an operator, multiple spaces MAY be used for readability purposes. --> |
| 287 | + <!-- All operators not described here are left undefined. --> |
| 288 | + |
| 289 | + <!-- 6.1. Unary operators --> |
287 | 290 |
|
288 |
| - <!-- There MUST NOT be any whitespace between the increment/decrement operators and the variable being incremented/decremented. --> |
| 291 | + <!-- The increment/decrement operators MUST NOT have any space between the operator and operand. --> |
289 | 292 | <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
290 | 293 |
|
291 |
| - <!-- Other operators are left undefined. --> |
| 294 | + <!-- Type casting operators MUST NOT have any space within the parentheses. --> |
| 295 | + <rule ref="Squiz.WhiteSpace.CastSpacing"/> |
| 296 | + |
| 297 | + <!-- 6.2. Binary operators --> |
| 298 | + |
| 299 | + <!-- All binary arithmetic, comparison, assignment, bitwise, logical, string, and type operators MUST be preceded and followed by at least one space. --> |
| 300 | + <!-- checked by PSR12.Operators.OperatorSpacing --> |
| 301 | + |
| 302 | + <!-- 6.3. Ternary operators --> |
| 303 | + |
| 304 | + <!-- The conditional operator, also known simply as the ternary operator, MUST be preceded and followed by at least one space around both the ? and : characters. --> |
| 305 | + <!-- When the middle operand of the conditional operator is omitted, the operator MUST follow the same style rules as other binary comparison operators. --> |
| 306 | + <!-- checked by PSR12.Operators.OperatorSpacing --> |
292 | 307 |
|
293 | 308 | <!-- 7. Closures -->
|
294 | 309 |
|
|
309 | 324 |
|
310 | 325 | <!-- The opening brace MAY be on the same line as the class keyword so long as the list of implements interfaces does not wrap. If the list of interfaces wraps, the brace MUST be placed on the line immediately following the last interface. -->
|
311 | 326 |
|
312 |
| - <!-- 9. Type Casting --> |
313 |
| - |
314 |
| - <!-- There MUST NOT be any spaces inside the type casting parentheses. --> |
315 |
| - <rule ref="Squiz.WhiteSpace.CastSpacing"/> |
316 |
| - |
317 | 327 | </ruleset>
|
0 commit comments