@@ -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,11 +36,11 @@ discard block |
||
36 | 36 | |
37 | 37 | $commentEnd = $this->findCommentEnd($phpcsFile, $stackPtr, $tokens); |
38 | 38 | |
39 | - if (empty($tokens[$commentEnd]['comment_opener'])) { |
|
39 | + if (empty($tokens[ $commentEnd ][ 'comment_opener' ])) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $commentStart = $tokens[$commentEnd]['comment_opener']; |
|
43 | + $commentStart = $tokens[ $commentEnd ][ 'comment_opener' ]; |
|
44 | 44 | |
45 | 45 | $this->processReturn($phpcsFile, $commentStart); |
46 | 46 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | */ |
87 | 87 | private function findReturnTag(array $tokens, int $commentStart) |
88 | 88 | { |
89 | - return array_reduce($tokens[$commentStart]['comment_tags'], function ($carry, $tag) use ($tokens) { |
|
90 | - return $carry || ($tokens[$tag]['content'] === self::RETURN_TAG_NAME) ? $tag : false; |
|
89 | + return array_reduce($tokens[ $commentStart ][ 'comment_tags' ], function($carry, $tag) use ($tokens) { |
|
90 | + return $carry || ($tokens[ $tag ][ 'content' ] === self::RETURN_TAG_NAME) ? $tag : false; |
|
91 | 91 | }, false); |
92 | 92 | } |
93 | 93 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function parseTagForReturnType(array $tokens, int $returnPosition) |
101 | 101 | { |
102 | - $content = $tokens[$returnPosition + 2]['content']; |
|
102 | + $content = $tokens[ $returnPosition + 2 ][ 'content' ]; |
|
103 | 103 | // Support both a return type and a description. |
104 | 104 | preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $content, $returnParts); |
105 | 105 | |
106 | - return $returnParts[1] ?? false; |
|
106 | + return $returnParts[ 1 ] ?? false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function findCommentEnd(PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $tokens) |
118 | 118 | { |
119 | - $find = PHP_CodeSniffer_Tokens::$methodPrefixes + [T_WHITESPACE]; |
|
119 | + $find = PHP_CodeSniffer_Tokens::$methodPrefixes + [ T_WHITESPACE ]; |
|
120 | 120 | |
121 | 121 | $commentEnd = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true); |
122 | - if ($tokens[$commentEnd]['code'] !== T_COMMENT) { |
|
122 | + if ($tokens[ $commentEnd ][ 'code' ] !== T_COMMENT) { |
|
123 | 123 | return $commentEnd; |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // using the wrong comment type. If there is other code on the line, |
129 | 129 | // assume they relate to that code. |
130 | 130 | $prev = $phpcsFile->findPrevious($find, $commentEnd - 1, null, true); |
131 | - if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) { |
|
131 | + if ($prev !== false && $tokens[ $prev ][ 'line' ] === $tokens[ $commentEnd ][ 'line' ]) { |
|
132 | 132 | $commentEnd = $prev; |
133 | 133 | } |
134 | 134 |