OrderedTypesFixer
extends AbstractFixer
in package
implements
ConfigurableFixerInterface
uses
ConfigurableFixerTrait
FinalYes
Tags
Table of Contents
Interfaces
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
- createConfigurationDefinition() : FixerConfigurationResolverInterface
-
collectDisjunctiveNormalFormTypes()
: array{0: list
- |string>, 1: string}
- collectTypeAnalysis() : TypeAnalysis|null
-
collectUnionOrIntersectionTypes()
: array{0: list
, 1: string} - createTypeDeclarationTokens() : array<int, Token>
- fixCatchArgumentType() : void
- fixMethodArgumentType() : void
- fixMethodReturnType() : void
- fixPropertyType() : void
- getElements() : array<int, string>
- isTypeSortable() : bool
- runTypesThroughSortingAlgorithm() : mixed
- sortTypes() : void
Methods
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 TypesSpacesFixer. Must run after NullableTypeDeclarationFixer, NullableTypeDeclarationForDefaultNullValueFixer.
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
boolapplyFix()
protected
applyFix(SplFileInfo $file, Tokens $tokens) : void
Parameters
- $file : SplFileInfo
- $tokens : Tokens
createConfigurationDefinition()
protected
createConfigurationDefinition() : FixerConfigurationResolverInterface
Return values
FixerConfigurationResolverInterfacecollectDisjunctiveNormalFormTypes()
private
collectDisjunctiveNormalFormTypes(string $type) : array{0: list|string>, 1: string}
Parameters
- $type : string
Return values
array{0: list- |string>, 1: string}
collectTypeAnalysis()
private
collectTypeAnalysis(Tokens $tokens, int $startIndex, int $endIndex) : TypeAnalysis|null
Parameters
- $tokens : Tokens
- $startIndex : int
- $endIndex : int
Return values
TypeAnalysis|nullcollectUnionOrIntersectionTypes()
private
collectUnionOrIntersectionTypes(string $type) : array{0: list, 1: string}
Parameters
- $type : string
Return values
array{0: listcreateTypeDeclarationTokens()
private
createTypeDeclarationTokens(array<int, array<int, string>|string> $types, string $glue[, bool $isDisjunctive = false ]) : array<int, Token>
Parameters
- $types : array<int, array<int, string>|string>
- $glue : string
- $isDisjunctive : bool = false
Return values
array<int, Token>fixCatchArgumentType()
private
fixCatchArgumentType(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
fixMethodArgumentType()
private
fixMethodArgumentType(FunctionsAnalyzer $functionsAnalyzer, Tokens $tokens, int $index) : void
Parameters
- $functionsAnalyzer : FunctionsAnalyzer
- $tokens : Tokens
- $index : int
fixMethodReturnType()
private
fixMethodReturnType(FunctionsAnalyzer $functionsAnalyzer, Tokens $tokens, int $index) : void
Parameters
- $functionsAnalyzer : FunctionsAnalyzer
- $tokens : Tokens
- $index : int
fixPropertyType()
private
fixPropertyType(Tokens $tokens, int $index) : void
Parameters
- $tokens : Tokens
- $index : int
getElements()
private
getElements(Tokens $tokens) : array<int, string>
Parameters
- $tokens : Tokens
Tags
Return values
array<int, string>isTypeSortable()
private
isTypeSortable(TypeAnalysis $type) : bool
Parameters
- $type : TypeAnalysis
Return values
boolrunTypesThroughSortingAlgorithm()
private
runTypesThroughSortingAlgorithm(array<int, array<int, string>|string> $types) : mixed
Parameters
- $types : array<int, array<int, string>|string>
sortTypes()
private
sortTypes(TypeAnalysis $typeAnalysis, Tokens $tokens) : void
Parameters
- $typeAnalysis : TypeAnalysis
- $tokens : Tokens