Skip to content

Commit

Permalink
UselessSemicolonSniff: Fixed internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Jun 22, 2020
1 parent a3b4e39 commit 58fa5ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SlevomatCodingStandard/Sniffs/PHP/UselessSemicolonSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use PHP_CodeSniffer\Sniffs\Sniff;
use SlevomatCodingStandard\Helpers\TokenHelper;
use function array_key_exists;
use function count;
use function in_array;
use const T_ANON_CLASS;
use const T_CLOSE_CURLY_BRACKET;
Expand Down Expand Up @@ -148,7 +149,7 @@ private function removeUselessSemicolon(File $phpcsFile, int $semicolonPointer):
} while (true);

$fixEndPointer = $semicolonPointer;
do {
while ($fixEndPointer < count($tokens) - 1) {
if ($tokens[$fixEndPointer + 1]['code'] !== T_WHITESPACE) {
break;
}
Expand All @@ -158,7 +159,7 @@ private function removeUselessSemicolon(File $phpcsFile, int $semicolonPointer):
}

$fixEndPointer++;
} while (true);
}

$phpcsFile->fixer->beginChangeset();
for ($i = $fixStartPointer; $i <= $fixEndPointer; $i++) {
Expand Down

0 comments on commit 58fa5ea

Please sign in to comment.