@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace BestIt\Sniffs\Commenting; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace BestIt\Sniffs\Formatting; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace BestIt\CodeSniffer\Helper; |
6 | 6 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if (array_key_exists($lastGroupTagPos + 1, $this->commentTagOrder)) { |
98 | 98 | $tagAfterGroup = $this->getTagByPosition($lastGroupTagPos + 1); |
99 | - $tagAfterLineDiff = $tagAfterGroup['line'] - $lastGroupTag['line']; |
|
99 | + $tagAfterLineDiff = $tagAfterGroup['line'] - $lastGroupTag['line']; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | if ($tagBeforeLineDiff === 1) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $this->file->getFixer()->beginChangeset(); |
193 | 193 | |
194 | - $content = $this->file->getEolChar() . str_repeat(' ', $tagToken['level']) . ' *'; |
|
194 | + $content = $this->file->getEolChar().str_repeat(' ', $tagToken['level']).' *'; |
|
195 | 195 | |
196 | 196 | $this->file->getFixer()->addContentBefore($eolPtr, $content); |
197 | 197 |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | $lastVisibility = null; |
117 | 117 | $lastVisibilityEnd = -1; |
118 | 118 | |
119 | - for ($i = $position; $i < $endPosition; $i++){ |
|
119 | + for ($i = $position; $i < $endPosition; $i++) { |
|
120 | 120 | if ($tokens[$i]['type'] === 'T_CONST') { |
121 | 121 | $classElements[] = [ |
122 | 122 | 'type' => 'T_CONST', |
123 | 123 | 'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC', |
124 | 124 | 'name' => $tokens[$file->findNext(T_STRING, $i)]['content'] |
125 | 125 | ]; |
126 | - } elseif($tokens[$i]['type'] === 'T_FUNCTION'){ |
|
126 | + } elseif ($tokens[$i]['type'] === 'T_FUNCTION') { |
|
127 | 127 | $type = 'T_FUNCTION'; |
128 | 128 | $name = $tokens[$file->findNext(T_STRING, $i)]['content']; |
129 | - if (strcasecmp($name, '__destruct') === 0){ |
|
129 | + if (strcasecmp($name, '__destruct') === 0) { |
|
130 | 130 | $type .= '-DESTRUCT'; |
131 | - } elseif (strcasecmp($name, '__construct') === 0){ |
|
131 | + } elseif (strcasecmp($name, '__construct') === 0) { |
|
132 | 132 | $type .= '-CONSTRUCT'; |
133 | 133 | } |
134 | 134 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | ]; |
140 | 140 | $functionStart = $i; |
141 | 141 | $functionEnd = $file->findEndOfStatement($i); |
142 | - } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)){ |
|
142 | + } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)) { |
|
143 | 143 | $classElements[] = [ |
144 | 144 | 'type' => 'T_VARIABLE', |
145 | 145 | 'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC', |
146 | 146 | 'name' => $tokens[$i]['content'] |
147 | 147 | ]; |
148 | - } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])){ |
|
148 | + } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])) { |
|
149 | 149 | $lastVisibility = $tokens[$i]['type']; |
150 | 150 | $lastVisibilityEnd = $file->findEndOfStatement($i); |
151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $originalClassElements = $classElements; |
155 | 155 | usort($classElements, [$this, 'sort']); |
156 | 156 | |
157 | - if ($classElements !== $originalClassElements){ |
|
157 | + if ($classElements !== $originalClassElements) { |
|
158 | 158 | self::throwError($file, $position); |
159 | 159 | } |
160 | 160 | } |