NoExtraBlankLinesFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface, WhitespacesAwareFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Properties
- $availableTokens : array<int, string>
- $tokenEqualsMap : array<string, callable(int): void>
- $tokenKindCallbackMap : array<int, callable(int): void>
- $tokens : Tokens
- $tokensAnalyzer : TokensAnalyzer
Methods
- getDefinition() : FixerDefinitionInterface
- Returns the definition of the fixer.
- getPriority() : int
- Returns the priority of the fixer.
- isCandidate() : bool
- Check if the fixer is a candidate for given Tokens collection.
- applyFix() : void
- configurePostNormalisation() : void
- configurePreNormalisation() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- containsLinebreak() : bool
- fixAfterCaseToken() : void
- fixAfterThrowToken() : void
- fixAfterToken() : void
- fixByToken() : void
- fixStructureOpenCloseIfMultiLine() : void
- Remove white line(s) after the index of a block type, but only if the block is not on one line.
- removeBetweenUse() : void
- removeEmptyLinesAfterLineWithTokenAt() : void
- removeMultipleBlankLines() : void
Properties
$availableTokens
private
static array<int, string>
$availableTokens
= ['attribute', 'break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait']
$tokenEqualsMap
private
array<string, callable(int): void>
$tokenEqualsMap
key is token's content
$tokenKindCallbackMap
private
array<int, callable(int): void>
$tokenKindCallbackMap
key is token id
$tokens
private
Tokens
$tokens
$tokensAnalyzer
private
TokensAnalyzer
$tokensAnalyzer
Methods
getDefinition()
Returns the definition of the fixer.
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
Returns the priority of the fixer.
public
getPriority() : int
Must run before BlankLineBeforeStatementFixer. Must run after ClassAttributesSeparationFixer, CombineConsecutiveUnsetsFixer, EmptyLoopBodyFixer, EmptyLoopConditionFixer, FunctionToConstantFixer, LongToShorthandOperatorFixer, ModernizeStrposFixer, NoEmptyCommentFixer, NoEmptyPhpdocFixer, NoEmptyStatementFixer, NoUnusedImportsFixer, NoUselessElseFixer, NoUselessReturnFixer, NoUselessSprintfFixer, PhpdocReadonlyClassCommentToKeywordFixer, StringLengthToEmptyFixer, YieldFromArrayToYieldsFixer.
Return values
intisCandidate()
Check if the fixer is a candidate for given Tokens collection.
public
isCandidate(Tokens $tokens) : bool
Fixer is a candidate when the collection contains tokens that may be fixed during fixer work. This could be considered as some kind of bloom filter. When this method returns true then to the Tokens collection may or may not need a fixing, but when this method returns false then the Tokens collection need no fixing for sure.
Parameters
- $tokens : Tokens
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
configurePostNormalisation()
protected
configurePostNormalisation() : void
configurePreNormalisation()
protected
configurePreNormalisation(_AutogeneratedInputConfiguration $configuration) : void
Parameters
- $configuration : _AutogeneratedInputConfiguration
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacecontainsLinebreak()
private
containsLinebreak(int $startIndex, int $endIndex) : bool
Parameters
- $startIndex : int
- $endIndex : int
Return values
boolfixAfterCaseToken()
private
fixAfterCaseToken(int $index) : void
Parameters
- $index : int
fixAfterThrowToken()
private
fixAfterThrowToken(int $index) : void
Parameters
- $index : int
fixAfterToken()
private
fixAfterToken(int $index) : void
Parameters
- $index : int
fixByToken()
private
fixByToken(Token $token, int $index) : void
Parameters
- $token : Token
- $index : int
Tags
fixStructureOpenCloseIfMultiLine()
Remove white line(s) after the index of a block type, but only if the block is not on one line.
private
fixStructureOpenCloseIfMultiLine(int $index) : void
Parameters
- $index : int
-
body start
removeBetweenUse()
private
removeBetweenUse(int $index) : void
Parameters
- $index : int
removeEmptyLinesAfterLineWithTokenAt()
private
removeEmptyLinesAfterLineWithTokenAt(int $index) : void
Parameters
- $index : int
removeMultipleBlankLines()
private
removeMultipleBlankLines(int $index) : void
Parameters
- $index : int