@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | class MethodFlagParameterSniff implements PHP_CodeSniffer_Sniff |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - protected $booleans = ['T_FALSE', 'T_TRUE']; |
|
| 11 | + protected $booleans = [ 'T_FALSE', 'T_TRUE' ]; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Returns the token types that this sniff is interested in. |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function register() |
| 18 | 18 | { |
| 19 | - return [T_FUNCTION]; |
|
| 19 | + return [ T_FUNCTION ]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $tokens = $phpcsFile->getTokens(); |
| 33 | 33 | |
| 34 | - $token = $tokens[$stackPtr]; |
|
| 35 | - $openParenIndex = $token['parenthesis_opener']; |
|
| 36 | - $closedParenIndex = $token['parenthesis_closer']; |
|
| 34 | + $token = $tokens[ $stackPtr ]; |
|
| 35 | + $openParenIndex = $token[ 'parenthesis_opener' ]; |
|
| 36 | + $closedParenIndex = $token[ 'parenthesis_closer' ]; |
|
| 37 | 37 | |
| 38 | - for ($index=$openParenIndex+1; $index <= $closedParenIndex; $index++) { |
|
| 39 | - if (in_array($tokens[$index]['type'], $this->booleans)) { |
|
| 38 | + for ($index = $openParenIndex + 1; $index <= $closedParenIndex; $index++) { |
|
| 39 | + if (in_array($tokens[ $index ][ 'type' ], $this->booleans)) { |
|
| 40 | 40 | $phpcsFile->addError("Function/method contains a flag parameter.", $stackPtr); |
| 41 | 41 | continue; |
| 42 | 42 | } |