@@ -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 | |
@@ -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\Sniffs\TypeHints; |
| 6 | 6 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | ); |
| 329 | 329 | |
| 330 | 330 | if ($sniffName) { |
| 331 | - $sniffFQCN .= '.' . $sniffName; |
|
| 331 | + $sniffFQCN .= '.'.$sniffName; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | return $sniffFQCN; |
@@ -150,19 +150,19 @@ discard block |
||
| 150 | 150 | $lastVisibility = null; |
| 151 | 151 | $lastVisibilityEnd = -1; |
| 152 | 152 | |
| 153 | - for ($i = $position; $i < $endPosition; $i++){ |
|
| 153 | + for ($i = $position; $i < $endPosition; $i++) { |
|
| 154 | 154 | if ($tokens[$i]['type'] === 'T_CONST') { |
| 155 | 155 | $classElements[] = [ |
| 156 | 156 | 'type' => 'T_CONST', |
| 157 | 157 | 'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC', |
| 158 | 158 | 'name' => $tokens[$file->findNext(T_STRING, $i)]['content'] |
| 159 | 159 | ]; |
| 160 | - } elseif($tokens[$i]['type'] === 'T_FUNCTION'){ |
|
| 160 | + } elseif ($tokens[$i]['type'] === 'T_FUNCTION') { |
|
| 161 | 161 | $type = 'T_FUNCTION'; |
| 162 | 162 | $name = $tokens[$file->findNext(T_STRING, $i)]['content']; |
| 163 | - if (strcasecmp($name, '__destruct') === 0){ |
|
| 163 | + if (strcasecmp($name, '__destruct') === 0) { |
|
| 164 | 164 | $type .= '-DESTRUCT'; |
| 165 | - } elseif (strcasecmp($name, '__construct') === 0){ |
|
| 165 | + } elseif (strcasecmp($name, '__construct') === 0) { |
|
| 166 | 166 | $type .= '-CONSTRUCT'; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | ]; |
| 174 | 174 | $functionStart = $i; |
| 175 | 175 | $functionEnd = $file->findEndOfStatement($i); |
| 176 | - } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)){ |
|
| 176 | + } elseif ($tokens[$i]['type'] === 'T_VARIABLE' && ($i < $functionStart || $i > $functionEnd)) { |
|
| 177 | 177 | $classElements[] = [ |
| 178 | 178 | 'type' => 'T_VARIABLE', |
| 179 | 179 | 'visibility' => $i <= $lastVisibilityEnd ? $lastVisibility : 'T_PUBLIC', |
| 180 | 180 | 'name' => $tokens[$i]['content'] |
| 181 | 181 | ]; |
| 182 | - } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])){ |
|
| 182 | + } elseif (in_array($tokens[$i]['type'], ['T_PRIVATE', 'T_PROTECTED', 'T_PUBLIC'])) { |
|
| 183 | 183 | $lastVisibility = $tokens[$i]['type']; |
| 184 | 184 | $lastVisibilityEnd = $file->findEndOfStatement($i); |
| 185 | 185 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $originalClassElements = $classElements; |
| 189 | 189 | usort($classElements, [$this, 'sort']); |
| 190 | 190 | |
| 191 | - if ($classElements !== $originalClassElements){ |
|
| 191 | + if ($classElements !== $originalClassElements) { |
|
| 192 | 192 | self::throwFixableError($file, $position); |
| 193 | 193 | } |
| 194 | 194 | } |