Documentation

NoExtraBlankLinesFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

Dariusz Rumiński dariusz.ruminski@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ tokens?: list<'attribute'|'break'|'case'|'continue'|'curly_brace_block'|'default'|'extra'|'parenthesis_brace_block'|'return'|'square_brace_block'|'switch'|'throw'|'use'|'use_trait'> }

phpstan-type

_AutogeneratedComputedConfiguration array{ tokens: list<'attribute'|'break'|'case'|'continue'|'curly_brace_block'|'default'|'extra'|'parenthesis_brace_block'|'return'|'square_brace_block'|'switch'|'throw'|'use'|'use_trait'> }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

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

Methods

getPriority()

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
int

isCandidate()

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
bool

configurePreNormalisation()

protected configurePreNormalisation(_AutogeneratedInputConfiguration $configuration) : void
Parameters
$configuration : _AutogeneratedInputConfiguration

containsLinebreak()

private containsLinebreak(int $startIndex, int $endIndex) : bool
Parameters
$startIndex : int
$endIndex : int
Return values
bool

fixByToken()

private fixByToken(Token $token, int $index) : void
Parameters
$token : Token
$index : int
Tags
uses
fixAfterToken()
uses
fixAfterCaseToken()
uses
fixAfterThrowToken()
uses
fixStructureOpenCloseIfMultiLine()
uses
removeBetweenUse()
uses
removeMultipleBlankLines()

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

removeEmptyLinesAfterLineWithTokenAt()

private removeEmptyLinesAfterLineWithTokenAt(int $index) : void
Parameters
$index : int

removeMultipleBlankLines()

private removeMultipleBlankLines(int $index) : void
Parameters
$index : int

        
On this page

Search results