Documentation

FunctionToConstantFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ functions?: list<'get_called_class'|'get_class'|'get_class_this'|'php_sapi_name'|'phpversion'|'pi'> }

phpstan-type

_AutogeneratedComputedConfiguration array{ functions: list<'get_called_class'|'get_class'|'get_class_this'|'php_sapi_name'|'phpversion'|'pi'> }

Table of Contents

Interfaces

ConfigurableFixerInterface

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

Methods

getPriority()

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
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

isRisky()

Check if fixer is risky or not.

public isRisky() : bool

Risky fixer could change code behavior!

Return values
bool

fixFunctionCallToConstant()

private fixFunctionCallToConstant(Tokens $tokens, int $index, int $braceOpenIndex, int $braceCloseIndex, array<int, Token$replacements) : void
Parameters
$tokens : Tokens
$index : int
$braceOpenIndex : int
$braceCloseIndex : int
$replacements : array<int, Token>

fixGetClassCall()

private fixGetClassCall(Tokens $tokens, FunctionsAnalyzer $functionAnalyzer, int $index) : Token>}|null
Parameters
$tokens : Tokens
$functionAnalyzer : FunctionsAnalyzer
$index : int
Return values
Token>}|null

getReplaceCandidate()

private getReplaceCandidate(Tokens $tokens, FunctionsAnalyzer $functionAnalyzer, int $index) : Token>}|null
Parameters
$tokens : Tokens
$functionAnalyzer : FunctionsAnalyzer
$index : int
Return values
Token>}|null

getReplacementTokenClones()

private getReplacementTokenClones(string $lowerContent, int $braceOpenIndex, int $braceCloseIndex) : Token>}
Parameters
$lowerContent : string
$braceOpenIndex : int
$braceCloseIndex : int
Return values
Token>}

        
On this page

Search results