@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function register() |
27 | 27 | { |
28 | - return [T_FUNCTION, T_CLOSURE, T_SWITCH]; |
|
28 | + return [ T_FUNCTION, T_CLOSURE, T_SWITCH ]; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
40 | 40 | { |
41 | 41 | $tokens = $phpcsFile->getTokens(); |
42 | - $token = $tokens[$stackPtr]; |
|
42 | + $token = $tokens[ $stackPtr ]; |
|
43 | 43 | $this->maxIndentationFound = 0; |
44 | 44 | |
45 | 45 | // Ignore functions with no body |
46 | - if (isset($token['scope_opener']) === false) { |
|
46 | + if (isset($token[ 'scope_opener' ]) === false) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function inspectScope(array $token, array $tokens) |
66 | 66 | { |
67 | - $start = $token['scope_opener']; |
|
68 | - $length = $token['scope_closer'] - $start + 1; |
|
69 | - $relativeScopeLevel = $tokens[$start]['level']; |
|
67 | + $start = $token[ 'scope_opener' ]; |
|
68 | + $length = $token[ 'scope_closer' ] - $start + 1; |
|
69 | + $relativeScopeLevel = $tokens[ $start ][ 'level' ]; |
|
70 | 70 | |
71 | 71 | $scope = array_slice($tokens, $start, $length, true); |
72 | 72 | $scope = $this->removeTokenScopes($scope, 'T_SWITCH'); |
73 | 73 | |
74 | - $this->maxIndentationFound = array_reduce($scope, function ($max, $nestedToken) use ($relativeScopeLevel) { |
|
75 | - $max = max($max, $nestedToken['level'] - $relativeScopeLevel); |
|
74 | + $this->maxIndentationFound = array_reduce($scope, function($max, $nestedToken) use ($relativeScopeLevel) { |
|
75 | + $max = max($max, $nestedToken[ 'level' ] - $relativeScopeLevel); |
|
76 | 76 | return $max; |
77 | 77 | }); |
78 | 78 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function removeTokenScopes(array $scope, $type) |
87 | 87 | { |
88 | - $typeTokens = array_filter($scope, function ($token) use ($type) { |
|
89 | - return $token['type'] == $type; |
|
88 | + $typeTokens = array_filter($scope, function($token) use ($type) { |
|
89 | + return $token[ 'type' ] == $type; |
|
90 | 90 | }); |
91 | 91 | |
92 | 92 | foreach ($typeTokens as $token) { |
93 | - $range = array_flip(range($token['scope_opener'], $token['scope_closer'])); |
|
93 | + $range = array_flip(range($token[ 'scope_opener' ], $token[ 'scope_closer' ])); |
|
94 | 94 | $scope = array_diff_key($scope, $range); |
95 | 95 | } |
96 | 96 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // indentation limit. |
109 | 109 | $indentationFound = $this->maxIndentationFound - 1; |
110 | 110 | $indentationLimit = $this->indentationLimit - 1; |
111 | - return "{$indentationFound} indentation levels found. " . |
|
111 | + return "{$indentationFound} indentation levels found. ". |
|
112 | 112 | "Maximum of {$indentationLimit} indentation levels allowed."; |
113 | 113 | } |
114 | 114 | } |