@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function register(): array |
19 | 19 | { |
20 | - return [T_FUNCTION]; |
|
20 | + return [ T_FUNCTION ]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | { |
34 | 34 | $tokens = $phpcsFile->getTokens(); |
35 | 35 | $find = PHP_CodeSniffer_Tokens::$methodPrefixes; |
36 | - $find[] = T_WHITESPACE; |
|
36 | + $find[ ] = T_WHITESPACE; |
|
37 | 37 | |
38 | 38 | $commentEnd = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true); |
39 | - if ($tokens[$commentEnd]['code'] === T_COMMENT) { |
|
39 | + if ($tokens[ $commentEnd ][ 'code' ] === T_COMMENT) { |
|
40 | 40 | // Inline comments might just be closing comments for |
41 | 41 | // control structures or functions instead of function comments |
42 | 42 | // using the wrong comment type. If there is other code on the line, |
43 | 43 | // assume they relate to that code. |
44 | 44 | $prev = $phpcsFile->findPrevious($find, $commentEnd - 1, null, true); |
45 | - if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) { |
|
45 | + if ($prev !== false && $tokens[ $prev ][ 'line' ] === $tokens[ $commentEnd ][ 'line' ]) { |
|
46 | 46 | $commentEnd = $prev; |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - $commentStart = $tokens[$commentEnd]['comment_opener']; |
|
50 | + $commentStart = $tokens[ $commentEnd ][ 'comment_opener' ]; |
|
51 | 51 | |
52 | 52 | $this->processReturn($phpcsFile, $commentStart); |
53 | 53 | } |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private function findReturnTag(array $tokens, int $commentStart): ?int |
98 | 98 | { |
99 | - return array_reduce($tokens[$commentStart]['comment_tags'], function ($carry, $tag) use ($tokens) { |
|
100 | - return $carry || ($tokens[$tag]['content'] === self::RETURN_TAG_NAME) ? $tag : null; |
|
99 | + return array_reduce($tokens[ $commentStart ][ 'comment_tags' ], function($carry, $tag) use ($tokens) { |
|
100 | + return $carry || ($tokens[ $tag ][ 'content' ] === self::RETURN_TAG_NAME) ? $tag : null; |
|
101 | 101 | }, null); |
102 | 102 | } |
103 | 103 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | private function parseTagForReturnType(array $tokens, int $returnPosition): ?string |
111 | 111 | { |
112 | - $content = $tokens[$returnPosition + 2]['content']; |
|
112 | + $content = $tokens[ $returnPosition + 2 ][ 'content' ]; |
|
113 | 113 | // Support both a return type and a description. |
114 | 114 | preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $content, $returnParts); |
115 | 115 | |
116 | - return $returnParts[1] ?? null; |
|
116 | + return $returnParts[ 1 ] ?? null; |
|
117 | 117 | } |
118 | 118 | } |