TernaryToNullCoalescingFixer
extends AbstractFixer
in package
FinalYes
Tags
Table of Contents
Methods
- getDefinition() : FixerDefinitionInterface
- getPriority() : int
- {@inheritdoc}
- isCandidate() : bool
- applyFix() : void
- fixIsset() : void
- getMeaningfulSequence() : Tokens
- Get the sequence of meaningful tokens and returns a new Tokens instance.
- hasChangingContent() : bool
- Check if the `isset()` content may change if called multiple times.
- isHigherPrecedenceAssociativityOperator() : bool
- Check if the requested token is an operator computed before the ternary operator along with the `isset()`.
Methods
getDefinition()
public
getDefinition() : FixerDefinitionInterface
Return values
FixerDefinitionInterfacegetPriority()
{@inheritdoc}
public
getPriority() : int
Must run before AssignNullCoalescingToCoalesceEqualFixer.
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
fixIsset()
private
fixIsset(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
-
of
T_ISSET
token
getMeaningfulSequence()
Get the sequence of meaningful tokens and returns a new Tokens instance.
private
getMeaningfulSequence(Tokens $tokens, int $start, int $end) : Tokens
Parameters
- $tokens : Tokens
- $start : int
-
start index
- $end : int
-
end index
Return values
TokenshasChangingContent()
Check if the `isset()` content may change if called multiple times.
private
hasChangingContent(Tokens $tokens) : bool
Parameters
- $tokens : Tokens
-
The original token list
Return values
boolisHigherPrecedenceAssociativityOperator()
Check if the requested token is an operator computed before the ternary operator along with the `isset()`.
private
isHigherPrecedenceAssociativityOperator(Token $token) : bool
Parameters
- $token : Token