function UselessSemicolonSniff::removeUselessSemicolon
3 calls to UselessSemicolonSniff::removeUselessSemicolon()
- UselessSemicolonSniff::checkMultipleSemicolons in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ UselessSemicolonSniff.php - UselessSemicolonSniff::checkSemicolonAfterScope in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ UselessSemicolonSniff.php - UselessSemicolonSniff::checkSemicolonAtTheBeginningOfScope in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ UselessSemicolonSniff.php
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ UselessSemicolonSniff.php, line 123
Class
Namespace
SlevomatCodingStandard\Sniffs\PHPCode
private function removeUselessSemicolon(File $phpcsFile, int $semicolonPointer) : void {
$tokens = $phpcsFile->getTokens();
$fixStartPointer = $semicolonPointer;
do {
if ($tokens[$fixStartPointer - 1]['code'] !== T_WHITESPACE) {
break;
}
$fixStartPointer--;
if ($tokens[$fixStartPointer]['content'] === $phpcsFile->eolChar) {
break;
}
} while (true);
$fixEndPointer = $semicolonPointer;
while ($fixEndPointer < count($tokens) - 1) {
if ($tokens[$fixEndPointer + 1]['code'] !== T_WHITESPACE) {
break;
}
if ($tokens[$fixEndPointer + 1]['content'] === $phpcsFile->eolChar) {
break;
}
$fixEndPointer++;
}
$phpcsFile->fixer
->beginChangeset();
FixerHelper::removeBetweenIncluding($phpcsFile, $fixStartPointer, $fixEndPointer);
$phpcsFile->fixer
->endChangeset();
}