@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function register(): array |
18 | 18 | { |
19 | - return [T_CLASS]; |
|
19 | + return [ T_CLASS ]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | * List of protected methods found. |
30 | 30 | * @var array |
31 | 31 | */ |
32 | - protected $protectedMethodTokens = []; |
|
32 | + protected $protectedMethodTokens = [ ]; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * List of protected variables found. |
36 | 36 | * @var array |
37 | 37 | */ |
38 | - protected $protectedVariableTokens = []; |
|
38 | + protected $protectedVariableTokens = [ ]; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Processes the tokens that this sniff is interested in. |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
50 | 50 | { |
51 | 51 | $this->classIsMarkedFinal = false; |
52 | - $this->protectedMethodTokens = []; |
|
53 | - $this->protectedVariableTokens = []; |
|
52 | + $this->protectedMethodTokens = [ ]; |
|
53 | + $this->protectedVariableTokens = [ ]; |
|
54 | 54 | |
55 | 55 | $tokens = $phpcsFile->getTokens(); |
56 | 56 | |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function handleToken($tokens, $index) |
71 | 71 | { |
72 | - $tokenType = $tokens[$index]['type']; |
|
72 | + $tokenType = $tokens[ $index ][ 'type' ]; |
|
73 | 73 | |
74 | 74 | if ($tokenType === 'T_FINAL') { |
75 | 75 | $this->classIsMarkedFinal = true; |
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - if (! $this->classIsMarkedFinal) { |
|
79 | + if (!$this->classIsMarkedFinal) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function handleFoundProtectedElement($tokens, $index) |
98 | 98 | { |
99 | - $type = $tokens[$index+2]['type']; |
|
99 | + $type = $tokens[ $index + 2 ][ 'type' ]; |
|
100 | 100 | |
101 | 101 | if ($type === 'T_VARIABLE') { |
102 | - $this->protectedVariableTokens[] = $tokens[$index+2]; |
|
102 | + $this->protectedVariableTokens[ ] = $tokens[ $index + 2 ]; |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
106 | - $this->protectedMethodTokens[] = $tokens[$index+4]; |
|
106 | + $this->protectedMethodTokens[ ] = $tokens[ $index + 4 ]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function handleProtectedMethodToken($token, $phpcsFile) |
133 | 133 | { |
134 | - $methodName = $token['content']; |
|
135 | - $line = $token['line']; |
|
134 | + $methodName = $token[ 'content' ]; |
|
135 | + $line = $token[ 'line' ]; |
|
136 | 136 | $phpcsFile->addError("Final Class contains a protected method {$methodName} - should be private.", $line); |
137 | 137 | } |
138 | 138 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | */ |
145 | 145 | protected function handleProtectedVariableToken($token, $phpcsFile) |
146 | 146 | { |
147 | - $variableName = $token['content']; |
|
148 | - $line = $token['line']; |
|
147 | + $variableName = $token[ 'content' ]; |
|
148 | + $line = $token[ 'line' ]; |
|
149 | 149 | $phpcsFile->addError("Final Class contains a protected variable {$variableName} - should be private.", $line); |
150 | 150 | } |
151 | 151 | } |