@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function register(): array |
20 | 20 | { |
21 | - return [T_FUNCTION]; |
|
21 | + return [ T_FUNCTION ]; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $commentEnd = $this->findCommentEnd($phpcsFile, $stackPtr, $tokens); |
38 | 38 | |
39 | - $commentStart = $tokens[$commentEnd]['comment_opener']; |
|
39 | + $commentStart = $tokens[ $commentEnd ][ 'comment_opener' ]; |
|
40 | 40 | |
41 | 41 | $this->processReturn($phpcsFile, $commentStart); |
42 | 42 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | */ |
83 | 83 | private function findReturnTag(array $tokens, int $commentStart) |
84 | 84 | { |
85 | - return array_reduce($tokens[$commentStart]['comment_tags'], function ($carry, $tag) use ($tokens) { |
|
86 | - return $carry || ($tokens[$tag]['content'] === self::RETURN_TAG_NAME) ? $tag : false; |
|
85 | + return array_reduce($tokens[ $commentStart ][ 'comment_tags' ], function($carry, $tag) use ($tokens) { |
|
86 | + return $carry || ($tokens[ $tag ][ 'content' ] === self::RETURN_TAG_NAME) ? $tag : false; |
|
87 | 87 | }, false); |
88 | 88 | } |
89 | 89 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function parseTagForReturnType(array $tokens, int $returnPosition) |
97 | 97 | { |
98 | - $content = $tokens[$returnPosition + 2]['content']; |
|
98 | + $content = $tokens[ $returnPosition + 2 ][ 'content' ]; |
|
99 | 99 | // Support both a return type and a description. |
100 | 100 | preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $content, $returnParts); |
101 | 101 | |
102 | - return isset($returnParts[1]) ? $returnParts[1] : false; |
|
102 | + return isset($returnParts[ 1 ]) ? $returnParts[ 1 ] : false; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function findCommentEnd(PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $tokens) |
114 | 114 | { |
115 | - $find = PHP_CodeSniffer_Tokens::$methodPrefixes + [T_WHITESPACE]; |
|
115 | + $find = PHP_CodeSniffer_Tokens::$methodPrefixes + [ T_WHITESPACE ]; |
|
116 | 116 | |
117 | 117 | $commentEnd = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true); |
118 | - if ($tokens[$commentEnd]['code'] !== T_COMMENT) { |
|
118 | + if ($tokens[ $commentEnd ][ 'code' ] !== T_COMMENT) { |
|
119 | 119 | return $commentEnd; |
120 | 120 | } |
121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // using the wrong comment type. If there is other code on the line, |
125 | 125 | // assume they relate to that code. |
126 | 126 | $prev = $phpcsFile->findPrevious($find, $commentEnd - 1, null, true); |
127 | - if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) { |
|
127 | + if ($prev !== false && $tokens[ $prev ][ 'line' ] === $tokens[ $commentEnd ][ 'line' ]) { |
|
128 | 128 | $commentEnd = $prev; |
129 | 129 | } |
130 | 130 |