CombineConsecutiveUnsetsFixer
extends AbstractFixer
in package
FinalYes
Table of Contents
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- clearOffsetTokens() : void
- getPreviousUnsetCall() : array{: int, : int, : int, : int}|int
- Find a previous call to unset directly before the index.
- moveTokens() : int
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before NoExtraBlankLinesFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer, SpaceAfterSemicolonFixer. Must run after NoEmptyStatementFixer, NoUnsetOnPropertyFixer, NoUselessElseFixer.
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
clearOffsetTokens()
private
clearOffsetTokens(Tokens $tokens, int $offset, array<int, int> $indices) : void
Parameters
- $tokens : Tokens
- $offset : int
- $indices : array<int, int>
getPreviousUnsetCall()
Find a previous call to unset directly before the index.
private
getPreviousUnsetCall(Tokens $tokens, int $index) : array{: int, : int, : int, : int}|int
Returns an array with
- unset index
- opening brace index
- closing brace index
- end semicolon index
Or the index to where the method looked for a call.
Parameters
- $tokens : Tokens
- $index : int
Return values
array{: int, : int, : int, : int}|intmoveTokens()
private
moveTokens(Tokens $tokens, int $start, int $end, int $to) : int
Parameters
- $tokens : Tokens
- $start : int
-
Index previous of the first token to move
- $end : int
-
Index of the last token to move
- $to : int
-
Upper boundary index
Return values
int —Number of tokens inserted