@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Codor\Sniffs\Syntax; |
4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function register(): array |
16 | 16 | { |
17 | - return [T_FUNCTION]; |
|
17 | + return [ T_FUNCTION ]; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
28 | 28 | { |
29 | 29 | $tokens = $phpcsFile->getTokens(); |
30 | - if (! isset($tokens[$stackPtr]['scope_closer'])) { |
|
30 | + if (!isset($tokens[ $stackPtr ][ 'scope_closer' ])) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - $endOfMethodIndex = $tokens[$stackPtr]['scope_closer']; |
|
34 | + $endOfMethodIndex = $tokens[ $stackPtr ][ 'scope_closer' ]; |
|
35 | 35 | $nextCodeLine = 0; |
36 | 36 | |
37 | - for ($index=$endOfMethodIndex + 1; $index <= count($tokens); $index++) { |
|
38 | - if (isset($tokens[$index]) && $tokens[$index]['type'] !== 'T_WHITESPACE') { |
|
39 | - $nextCodeLine = $tokens[$index]['line']; |
|
37 | + for ($index = $endOfMethodIndex + 1; $index <= count($tokens); $index++) { |
|
38 | + if (isset($tokens[ $index ]) && $tokens[ $index ][ 'type' ] !== 'T_WHITESPACE') { |
|
39 | + $nextCodeLine = $tokens[ $index ][ 'line' ]; |
|
40 | 40 | break; |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - $linesBetween = $nextCodeLine - $tokens[$endOfMethodIndex]['line'] - 1; |
|
44 | + $linesBetween = $nextCodeLine - $tokens[ $endOfMethodIndex ][ 'line' ] - 1; |
|
45 | 45 | if ($linesBetween > 1) { |
46 | 46 | $phpcsFile->addError("No more than 1 line after a method/function is allowed.", $stackPtr, __CLASS__); |
47 | 47 | } |