FunctionToConstantFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface
uses
ConfigurableFixerTrait
Tags
Table of Contents
Interfaces
Properties
- $availableFunctions : array<string, array<int, Token>>
- $functionsFixMap : array<string, array<int, Token>>
Methods
- __construct() : mixed
- 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.
- isRisky() : bool
- Check if fixer is risky or not.
- applyFix() : void
- configurePostNormalisation() : void
- createConfigurationDefinition() : FixerConfigurationResolverInterface
- fixFunctionCallToConstant() : void
- fixGetClassCall() : Token>}|null
- getReplaceCandidate() : Token>}|null
- getReplacementTokenClones() : Token>}
Properties
$availableFunctions
private
static array<string, array<int, Token>>
$availableFunctions
$functionsFixMap
private
array<string, array<int, Token>>
$functionsFixMap
Methods
__construct()
public
__construct() : mixed
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 NativeConstantInvocationFixer, NativeFunctionCasingFixer, NoExtraBlankLinesFixer, NoSinglelineWhitespaceBeforeSemicolonsFixer, NoTrailingWhitespaceFixer, NoWhitespaceInBlankLineFixer, SelfStaticAccessorFixer. Must run after NoSpacesAfterFunctionNameFixer, NoSpacesInsideParenthesisFixer, SpacesInsideParenthesesFixer.
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
boolisRisky()
Check if fixer is risky or not.
public
isRisky() : bool
Risky fixer could change code behavior!
Return values
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
configurePostNormalisation()
protected
configurePostNormalisation() : void
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacefixFunctionCallToConstant()
private
fixFunctionCallToConstant(Tokens $tokens, int $index, int $braceOpenIndex, int $braceCloseIndex, array<int, Token> $replacements) : void
Parameters
fixGetClassCall()
private
fixGetClassCall(Tokens $tokens, FunctionsAnalyzer $functionAnalyzer, int $index) : Token>}|null
Parameters
- $tokens : Tokens
- $functionAnalyzer : FunctionsAnalyzer
- $index : int
Return values
Token>}|nullgetReplaceCandidate()
private
getReplaceCandidate(Tokens $tokens, FunctionsAnalyzer $functionAnalyzer, int $index) : Token>}|null
Parameters
- $tokens : Tokens
- $functionAnalyzer : FunctionsAnalyzer
- $index : int
Return values
Token>}|nullgetReplacementTokenClones()
private
getReplacementTokenClones(string $lowerContent, int $braceOpenIndex, int $braceCloseIndex) : Token>}
Parameters
- $lowerContent : string
- $braceOpenIndex : int
- $braceCloseIndex : int