@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @var array |
37 | 37 | */ |
38 | 38 | public $supportedTokenizers = array( |
39 | - 'PHP', |
|
40 | - 'JS', |
|
41 | - ); |
|
39 | + 'PHP', |
|
40 | + 'JS', |
|
41 | + ); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | T_ELSEIF, |
60 | 60 | T_TRY, |
61 | 61 | T_CATCH, |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | 64 | }//end register() |
65 | 65 | |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | |
139 | 139 | // We ignore spacing for some structures that tend to have their own rules. |
140 | 140 | $ignore = array( |
141 | - T_FUNCTION => true, |
|
142 | - T_CLASS => true, |
|
143 | - T_INTERFACE => true, |
|
144 | - T_TRAIT => true, |
|
145 | - T_DOC_COMMENT_OPEN_TAG => true, |
|
146 | - ); |
|
141 | + T_FUNCTION => true, |
|
142 | + T_CLASS => true, |
|
143 | + T_INTERFACE => true, |
|
144 | + T_TRAIT => true, |
|
145 | + T_DOC_COMMENT_OPEN_TAG => true, |
|
146 | + ); |
|
147 | 147 | |
148 | 148 | if (isset($ignore[$tokens[$firstContent]['code']]) === false |
149 | 149 | && $tokens[$firstContent]['line'] >= ($tokens[$scopeOpener]['line'] + 2) |
@@ -41,7 +41,7 @@ |
||
41 | 41 | /** |
42 | 42 | * Returns an array of tokens this test wants to listen for. |
43 | 43 | * |
44 | - * @return array |
|
44 | + * @return integer[] |
|
45 | 45 | */ |
46 | 46 | public function register() |
47 | 47 | { |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @var array |
37 | 37 | */ |
38 | 38 | public $supportedTokenizers = array( |
39 | - 'PHP', |
|
40 | - 'JS', |
|
41 | - ); |
|
39 | + 'PHP', |
|
40 | + 'JS', |
|
41 | + ); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $found = $phpcsFile->getTokensAsString($nonSpace, ($stackPtr - $nonSpace)).';'; |
82 | 82 | $error = 'Space found before semicolon; expected "%s" but found "%s"'; |
83 | 83 | $data = array( |
84 | - $expected, |
|
85 | - $found, |
|
84 | + $expected, |
|
85 | + $found, |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * |
38 | 38 | * @param string $testFile The name of the file being tested. |
39 | 39 | * |
40 | - * @return array |
|
40 | + * @return string[] |
|
41 | 41 | */ |
42 | 42 | public function getCliValues($testFile) |
43 | 43 | { |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @var array |
37 | 37 | */ |
38 | 38 | public $supportedTokenizers = array( |
39 | - 'PHP', |
|
40 | - 'JS', |
|
41 | - ); |
|
39 | + 'PHP', |
|
40 | + 'JS', |
|
41 | + ); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Allow newlines instead of spaces. |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | $operators = PHP_CodeSniffer_Tokens::$operators; |
60 | 60 | $assignment = PHP_CodeSniffer_Tokens::$assignmentTokens; |
61 | 61 | $inlineIf = array( |
62 | - T_INLINE_THEN, |
|
63 | - T_INLINE_ELSE, |
|
64 | - ); |
|
62 | + T_INLINE_THEN, |
|
63 | + T_INLINE_ELSE, |
|
64 | + ); |
|
65 | 65 | |
66 | 66 | return array_unique( |
67 | 67 | array_merge($comparison, $operators, $assignment, $inlineIf) |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | // A list of tokens that indicate that the token is not |
220 | 220 | // part of an arithmetic operation. |
221 | 221 | $invalidTokens = array( |
222 | - T_COMMA => true, |
|
223 | - T_OPEN_PARENTHESIS => true, |
|
224 | - T_OPEN_SQUARE_BRACKET => true, |
|
225 | - T_OPEN_SHORT_ARRAY => true, |
|
226 | - T_DOUBLE_ARROW => true, |
|
227 | - T_COLON => true, |
|
228 | - T_INLINE_THEN => true, |
|
229 | - T_INLINE_ELSE => true, |
|
230 | - T_CASE => true, |
|
231 | - ); |
|
222 | + T_COMMA => true, |
|
223 | + T_OPEN_PARENTHESIS => true, |
|
224 | + T_OPEN_SQUARE_BRACKET => true, |
|
225 | + T_OPEN_SHORT_ARRAY => true, |
|
226 | + T_DOUBLE_ARROW => true, |
|
227 | + T_COLON => true, |
|
228 | + T_INLINE_THEN => true, |
|
229 | + T_INLINE_ELSE => true, |
|
230 | + T_CASE => true, |
|
231 | + ); |
|
232 | 232 | |
233 | 233 | if (isset($invalidTokens[$tokens[$prev]['code']]) === true) { |
234 | 234 | // Just trying to use a negative value; eg. myFunction($var, -2). |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | ) { |
262 | 262 | $error = 'Expected 1 space before "%s"; %s found'; |
263 | 263 | $data = array( |
264 | - $operator, |
|
265 | - $found, |
|
266 | - ); |
|
264 | + $operator, |
|
265 | + $found, |
|
266 | + ); |
|
267 | 267 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingBefore', $data); |
268 | 268 | if ($fix === true) { |
269 | 269 | $phpcsFile->fixer->beginChangeset(); |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | ) { |
309 | 309 | $error = 'Expected 1 space after "%s"; %s found'; |
310 | 310 | $data = array( |
311 | - $operator, |
|
312 | - $found, |
|
313 | - ); |
|
311 | + $operator, |
|
312 | + $found, |
|
313 | + ); |
|
314 | 314 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingAfter', $data); |
315 | 315 | if ($fix === true) { |
316 | 316 | $phpcsFile->fixer->replaceToken(($stackPtr + 1), ' '); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $operator, |
265 | 265 | $found, |
266 | 266 | ); |
267 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingBefore', $data); |
|
267 | + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingBefore', $data); |
|
268 | 268 | if ($fix === true) { |
269 | 269 | $phpcsFile->fixer->beginChangeset(); |
270 | 270 | if ($found === 'newline') { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $operator, |
312 | 312 | $found, |
313 | 313 | ); |
314 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingAfter', $data); |
|
314 | + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingAfter', $data); |
|
315 | 315 | if ($fix === true) { |
316 | 316 | $phpcsFile->fixer->replaceToken(($stackPtr + 1), ' '); |
317 | 317 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * @var array |
37 | 37 | */ |
38 | 38 | public $supportedTokenizers = array( |
39 | - 'PHP', |
|
40 | - 'JS', |
|
41 | - ); |
|
39 | + 'PHP', |
|
40 | + 'JS', |
|
41 | + ); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return array( |
52 | 52 | T_FUNCTION, |
53 | 53 | T_CLOSURE, |
54 | - ); |
|
54 | + ); |
|
55 | 55 | |
56 | 56 | }//end register() |
57 | 57 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | $nextContent = $phpcsFile->findNext(T_WHITESPACE, ($openBrace + 1), null, true); |
79 | 79 | |
80 | 80 | if ($nextContent === $tokens[$stackPtr]['scope_closer']) { |
81 | - // The next bit of content is the closing brace, so this |
|
82 | - // is an empty function and should have a blank line |
|
83 | - // between the opening and closing braces. |
|
81 | + // The next bit of content is the closing brace, so this |
|
82 | + // is an empty function and should have a blank line |
|
83 | + // between the opening and closing braces. |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | * @var array |
39 | 39 | */ |
40 | 40 | public $supportedTokenizers = array( |
41 | - 'PHP', |
|
42 | - 'JS', |
|
43 | - 'CSS', |
|
44 | - ); |
|
41 | + 'PHP', |
|
42 | + 'JS', |
|
43 | + 'CSS', |
|
44 | + ); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * If TRUE, whitespace rules are not checked for blank lines. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | T_COMMENT, |
68 | 68 | T_DOC_COMMENT_WHITESPACE, |
69 | 69 | T_CLOSURE, |
70 | - ); |
|
70 | + ); |
|
71 | 71 | |
72 | 72 | }//end register() |
73 | 73 |
@@ -63,9 +63,9 @@ |
||
63 | 63 | if ($content !== $expected) { |
64 | 64 | $error = 'Cast statements must not contain whitespace; expected "%s" but found "%s"'; |
65 | 65 | $data = array( |
66 | - $expected, |
|
67 | - $content, |
|
68 | - ); |
|
66 | + $expected, |
|
67 | + $content, |
|
68 | + ); |
|
69 | 69 | |
70 | 70 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'ContainsWhiteSpace', $data); |
71 | 71 | if ($fix === true) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | return array( |
63 | 63 | T_FUNCTION, |
64 | 64 | T_CLOSURE, |
65 | - ); |
|
65 | + ); |
|
66 | 66 | |
67 | 67 | }//end register() |
68 | 68 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | if ($spacesBefore !== $this->equalsSpacing) { |
142 | 142 | $error = 'Incorrect spacing between argument "%s" and equals sign; expected '.$this->equalsSpacing.' but found %s'; |
143 | 143 | $data = array( |
144 | - $tokens[$nextParam]['content'], |
|
145 | - $spacesBefore, |
|
146 | - ); |
|
144 | + $tokens[$nextParam]['content'], |
|
145 | + $spacesBefore, |
|
146 | + ); |
|
147 | 147 | |
148 | 148 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpaceBeforeEquals', $data); |
149 | 149 | if ($fix === true) { |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | if ($spacesAfter !== $this->equalsSpacing) { |
165 | 165 | $error = 'Incorrect spacing between default value and equals sign for argument "%s"; expected '.$this->equalsSpacing.' but found %s'; |
166 | 166 | $data = array( |
167 | - $tokens[$nextParam]['content'], |
|
168 | - $spacesAfter, |
|
169 | - ); |
|
167 | + $tokens[$nextParam]['content'], |
|
168 | + $spacesAfter, |
|
169 | + ); |
|
170 | 170 | |
171 | 171 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpaceAfterDefault', $data); |
172 | 172 | if ($fix === true) { |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | if ($tokens[($nextComma - 1)]['code'] === T_WHITESPACE) { |
188 | 188 | $error = 'Expected 0 spaces between argument "%s" and comma; %s found'; |
189 | 189 | $data = array( |
190 | - $tokens[$nextParam]['content'], |
|
191 | - strlen($tokens[($nextComma - 1)]['content']), |
|
192 | - ); |
|
190 | + $tokens[$nextParam]['content'], |
|
191 | + strlen($tokens[($nextComma - 1)]['content']), |
|
192 | + ); |
|
193 | 193 | |
194 | 194 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpaceBeforeComma', $data); |
195 | 195 | if ($fix === true) { |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | if ($gap !== 1) { |
236 | 236 | $error = 'Expected 1 space between type hint and argument "%s"; %s found'; |
237 | 237 | $data = array( |
238 | - $arg, |
|
239 | - $gap, |
|
240 | - ); |
|
238 | + $arg, |
|
239 | + $gap, |
|
240 | + ); |
|
241 | 241 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
242 | 242 | if ($fix === true) { |
243 | 243 | if ($gap === 0) { |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | if ($gap !== 1) { |
262 | 262 | $error = 'Expected 1 space between comma and type hint "%s"; %s found'; |
263 | 263 | $data = array( |
264 | - $hint, |
|
265 | - $gap, |
|
266 | - ); |
|
264 | + $hint, |
|
265 | + $gap, |
|
266 | + ); |
|
267 | 267 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingBeforeHint', $data); |
268 | 268 | if ($fix === true) { |
269 | 269 | $phpcsFile->fixer->replaceToken(($comma + 1), ' '); |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | if ($tokens[$whitespace]['line'] === $tokens[($whitespace - 1)]['line']) { |
286 | 286 | $error = 'Expected 1 space between comma and argument "%s"; %s found'; |
287 | 287 | $data = array( |
288 | - $arg, |
|
289 | - $gap, |
|
290 | - ); |
|
288 | + $arg, |
|
289 | + $gap, |
|
290 | + ); |
|
291 | 291 | |
292 | 292 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingBeforeArg', $data); |
293 | 293 | if ($fix === true) { |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | if ($gap !== 1) { |
320 | 320 | $error = 'Expected 1 space between type hint and argument "%s"; %s found'; |
321 | 321 | $data = array( |
322 | - $arg, |
|
323 | - $gap, |
|
324 | - ); |
|
322 | + $arg, |
|
323 | + $gap, |
|
324 | + ); |
|
325 | 325 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
326 | 326 | if ($fix === true) { |
327 | 327 | if ($gap === 0) { |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | if ($multiLine === false && $spaceAfterOpen !== $this->requiredSpacesAfterOpen) { |
341 | 341 | $error = 'Expected %s spaces between opening bracket and type hint "%s"; %s found'; |
342 | 342 | $data = array( |
343 | - $this->requiredSpacesAfterOpen, |
|
344 | - $hint, |
|
345 | - $spaceAfterOpen, |
|
346 | - ); |
|
343 | + $this->requiredSpacesAfterOpen, |
|
344 | + $hint, |
|
345 | + $spaceAfterOpen, |
|
346 | + ); |
|
347 | 347 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpenHint', $data); |
348 | 348 | if ($fix === true) { |
349 | 349 | $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | } else if ($multiLine === false && $gap !== $this->requiredSpacesAfterOpen) { |
358 | 358 | $error = 'Expected %s spaces between opening bracket and argument "%s"; %s found'; |
359 | 359 | $data = array( |
360 | - $this->requiredSpacesAfterOpen, |
|
361 | - $arg, |
|
362 | - $gap, |
|
363 | - ); |
|
360 | + $this->requiredSpacesAfterOpen, |
|
361 | + $arg, |
|
362 | + $gap, |
|
363 | + ); |
|
364 | 364 | $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpen', $data); |
365 | 365 | if ($fix === true) { |
366 | 366 | $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | $lastParam = array_pop($params); |
396 | 396 | $error = 'Expected %s spaces between argument "%s" and closing bracket; %s found'; |
397 | 397 | $data = array( |
398 | - $this->requiredSpacesBeforeClose, |
|
399 | - $tokens[$lastParam]['content'], |
|
400 | - $gap, |
|
401 | - ); |
|
398 | + $this->requiredSpacesBeforeClose, |
|
399 | + $tokens[$lastParam]['content'], |
|
400 | + $gap, |
|
401 | + ); |
|
402 | 402 | $fix = $phpcsFile->addFixableError($error, $closeBracket, 'SpacingBeforeClose', $data); |
403 | 403 | if ($fix === true) { |
404 | 404 | $padding = str_repeat(' ', $this->requiredSpacesBeforeClose); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $arg, |
239 | 239 | $gap, |
240 | 240 | ); |
241 | - $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
|
241 | + $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
|
242 | 242 | if ($fix === true) { |
243 | 243 | if ($gap === 0) { |
244 | 244 | $phpcsFile->fixer->addContent($whitespace, ' '); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $hint, |
265 | 265 | $gap, |
266 | 266 | ); |
267 | - $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingBeforeHint', $data); |
|
267 | + $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingBeforeHint', $data); |
|
268 | 268 | if ($fix === true) { |
269 | 269 | $phpcsFile->fixer->replaceToken(($comma + 1), ' '); |
270 | 270 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $arg, |
323 | 323 | $gap, |
324 | 324 | ); |
325 | - $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
|
325 | + $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterHint', $data); |
|
326 | 326 | if ($fix === true) { |
327 | 327 | if ($gap === 0) { |
328 | 328 | $phpcsFile->fixer->addContent($nextToken, ' '); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $hint, |
345 | 345 | $spaceAfterOpen, |
346 | 346 | ); |
347 | - $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpenHint', $data); |
|
347 | + $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpenHint', $data); |
|
348 | 348 | if ($fix === true) { |
349 | 349 | $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); |
350 | 350 | if ($spaceAfterOpen === 0) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $arg, |
362 | 362 | $gap, |
363 | 363 | ); |
364 | - $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpen', $data); |
|
364 | + $fix = $phpcsFile->addFixableError($error, $nextToken, 'SpacingAfterOpen', $data); |
|
365 | 365 | if ($fix === true) { |
366 | 366 | $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); |
367 | 367 | if ($gap === 0) { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $tokens[$lastParam]['content'], |
400 | 400 | $gap, |
401 | 401 | ); |
402 | - $fix = $phpcsFile->addFixableError($error, $closeBracket, 'SpacingBeforeClose', $data); |
|
402 | + $fix = $phpcsFile->addFixableError($error, $closeBracket, 'SpacingBeforeClose', $data); |
|
403 | 403 | if ($fix === true) { |
404 | 404 | $padding = str_repeat(' ', $this->requiredSpacesBeforeClose); |
405 | 405 | if ($gap === 0) { |
@@ -165,7 +165,7 @@ |
||
165 | 165 | * |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function processBracket(PHP_CodeSniffer_File $phpcsFile, $openBracket, $tokens, $type='function') |
|
168 | + public function processBracket(PHP_CodeSniffer_File $phpcsFile, $openBracket, $tokens, $type = 'function') |
|
169 | 169 | { |
170 | 170 | $errorPrefix = ''; |
171 | 171 | if ($type === 'use') { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * Should this test be skipped for some reason. |
37 | 37 | * |
38 | - * @return void |
|
38 | + * @return boolean |
|
39 | 39 | */ |
40 | 40 | protected function shouldSkipTest() |
41 | 41 | { |
@@ -34,9 +34,9 @@ |
||
34 | 34 | * @var array |
35 | 35 | */ |
36 | 36 | public $supportedTokenizers = array( |
37 | - 'PHP', |
|
38 | - 'JS', |
|
39 | - ); |
|
37 | + 'PHP', |
|
38 | + 'JS', |
|
39 | + ); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | T_PRIVATE, |
45 | 45 | T_PROTECTED, |
46 | 46 | T_STATIC, |
47 | - ); |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | }//end register() |
50 | 50 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | if ($content !== strtolower($content)) { |
67 | 67 | $error = '%s keyword must be lowercase; expected "%s" but found "%s"'; |
68 | 68 | $data = array( |
69 | - strtoupper($content), |
|
70 | - strtolower($content), |
|
71 | - $content, |
|
72 | - ); |
|
69 | + strtoupper($content), |
|
70 | + strtolower($content), |
|
71 | + $content, |
|
72 | + ); |
|
73 | 73 | $phpcsFile->addError($error, $stackPtr, 'FoundUppercase', $data); |
74 | 74 | } |
75 | 75 |