@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function register() |
14 | 14 | { |
15 | - return [T_ELSE, T_ELSEIF]; |
|
15 | + return [ T_ELSE, T_ELSEIF ]; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -12,25 +12,25 @@ |
||
12 | 12 | |
13 | 13 | public function register() |
14 | 14 | { |
15 | - return [T_FUNCTION]; |
|
15 | + return [ T_FUNCTION ]; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
19 | 19 | { |
20 | 20 | $tokens = $phpcsFile->getTokens(); |
21 | - $token = $tokens[$stackPtr]; |
|
21 | + $token = $tokens[ $stackPtr ]; |
|
22 | 22 | |
23 | 23 | // Skip function without body. |
24 | - if (isset($token['scope_opener']) === false) { |
|
24 | + if (isset($token[ 'scope_opener' ]) === false) { |
|
25 | 25 | return 0; |
26 | 26 | } |
27 | 27 | |
28 | - $firstToken = $tokens[$token['scope_opener']]; |
|
29 | - $lastToken = $tokens[$token['scope_closer']]; |
|
30 | - $length = $lastToken['line'] - $firstToken['line']; |
|
28 | + $firstToken = $tokens[ $token[ 'scope_opener' ] ]; |
|
29 | + $lastToken = $tokens[ $token[ 'scope_closer' ] ]; |
|
30 | + $length = $lastToken[ 'line' ] - $firstToken[ 'line' ]; |
|
31 | 31 | |
32 | 32 | if ($length > $this->maxLength) { |
33 | - $tokenType = strtolower(substr($token['type'], 2)); |
|
33 | + $tokenType = strtolower(substr($token[ 'type' ], 2)); |
|
34 | 34 | $error = "Function is {$length} lines. Must be {$this->maxLength} lines or fewer."; |
35 | 35 | $phpcsFile->addError($error, $stackPtr, sprintf('%sTooBig', ucfirst($tokenType))); |
36 | 36 | } |