NoEmptyStatementFixer
extends AbstractFixer
in package
FinalYes
Tags
Table of Contents
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- fixSemicolonAfterCurlyBraceClose() : void
- Fix semicolon after closing curly brace if needed.
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before BracesFixer, CombineConsecutiveUnsetsFixer, EmptyLoopBodyFixer, MultilineWhitespaceBeforeSemicolonsFixer, NoExtraBlankLinesFixer, NoMultipleStatementsPerLineFixer, NoSinglelineWhitespaceBeforeSemicolonsFixer, NoTrailingWhitespaceFixer, NoUselessElseFixer, NoUselessReturnFixer, NoWhitespaceInBlankLineFixer, ReturnAssignmentFixer, SpaceAfterSemicolonFixer, SwitchCaseSemicolonToColonFixer. Must run after NoUselessSprintfFixer.
Return values
intisCandidate()
public
isCandidate(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
fixSemicolonAfterCurlyBraceClose()
Fix semicolon after closing curly brace if needed.
private
fixSemicolonAfterCurlyBraceClose(Tokens $tokens, int $index, int $curlyCloseIndex) : void
Test for the following cases
- just '{' '}' block (following open tag or ';')
- if, else, elseif
- interface, trait, class (but not anonymous)
- catch, finally (but not try)
- for, foreach, while (but not 'do - while')
- switch
- function (declaration, but not lambda)
- declare (with '{' '}')
- namespace (with '{' '}')
Parameters
- $tokens : Tokens
- $index : int
-
Semicolon index
- $curlyCloseIndex : int