Documentation

FullyQualifiedStrictTypesFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

VeeWee toonverwerft@gmail.com

author

Tomas Jadrny developer@tomasjadrny.cz

author

Greg Korba greg@codito.dev

author

SpacePossum possumfromspace@gmail.com

author

Michael Vorisek https://github.com/mvorisek

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ import_symbols?: bool, leading_backslash_in_global_namespace?: bool, phpdoc_tags?: list }

phpstan-type

_AutogeneratedComputedConfiguration array{ import_symbols: bool, leading_backslash_in_global_namespace: bool, phpdoc_tags: list }

Table of Contents

Interfaces

ConfigurableFixerInterface
WhitespacesAwareFixerInterface

Constants

REGEX_CLASS  = '(?:\\\\?+' . \PhpCsFixer\DocBlock\TypeExpression::REGEX_IDENTIFIER . '(\\\\' . \PhpCsFixer\DocBlock\TypeExpression::REGEX_IDENTIFIER . ')*+)'

Properties

$cacheUseNameByShortNameLower  : array<string, string>
$cacheUseShortNameByNameLower  : array<string, string>
$cacheUsesLast  : array<string, string>
$discoveredSymbols  : array{const?: list, class?: list, function?: list}|null
$reservedIdentifiersByLevel  : array<int<0, max>, array<string, true>>
$symbolsForImport  : array{const?: array, class?: array, function?: array}

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
createImportProcessor()  : ImportProcessor
We need to create import processor dynamically (not in costructor), because actual whitespace configuration is set later, not when fixer's instance is created.
determineShortType()  : null|array<int, Token>
Determines short type based on FQCN, current namespace and imports (`use` declarations).
fixAttribute()  : void
fixCatch()  : void
fixExtendsImplements()  : void
fixFunction()  : void
fixNextName()  : void
fixPhpDoc()  : void
fixPrevName()  : void
getTypes()  : iterable<string|int, array{: int, : int}>
isReservedIdentifier()  : bool
namespacedStringToTokens()  : array<int, Token>
refreshUsesCache()  : void
replaceByShortType()  : void
resolveSymbol()  : string
Resolve absolute or relative symbol to normalized FQCN.
setupUsesFromDiscoveredSymbols()  : void
shortenClassIfPossible()  : int
shortenSymbol()  : string
Shorten normalized FQCN as much as possible.

Constants

REGEX_CLASS

private mixed REGEX_CLASS = '(?:\\\\?+' . \PhpCsFixer\DocBlock\TypeExpression::REGEX_IDENTIFIER . '(\\\\' . \PhpCsFixer\DocBlock\TypeExpression::REGEX_IDENTIFIER . ')*+)'

Properties

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before NoSuperfluousPhpdocTagsFixer, OrderedAttributesFixer, OrderedImportsFixer, OrderedInterfacesFixer, StatementIndentationFixer. Must run after ClassKeywordFixer, PhpUnitAttributesFixer, PhpdocToReturnTypeFixer.

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

determineShortType()

Determines short type based on FQCN, current namespace and imports (`use` declarations).

private determineShortType(string $typeName, array<string, string> $uses, string $namespaceName) : null|array<int, Token>
Parameters
$typeName : string
$uses : array<string, string>
$namespaceName : string
Return values
null|array<int, Token>

fixAttribute()

private fixAttribute(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixCatch()

private fixCatch(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixExtendsImplements()

private fixExtendsImplements(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixFunction()

private fixFunction(FunctionsAnalyzer $functionsAnalyzer, Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$functionsAnalyzer : FunctionsAnalyzer
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixNextName()

private fixNextName(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixPhpDoc()

private fixPhpDoc(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

fixPrevName()

private fixPrevName(Tokens $tokens, int $index, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$index : int
$uses : array<string, string>
$namespaceName : string

getTypes()

private getTypes(Tokens $tokens, int $index, int $endIndex) : iterable<string|int, array{: int, : int}>
Parameters
$tokens : Tokens
$index : int
$endIndex : int
Return values
iterable<string|int, array{: int, : int}>

replaceByShortType()

private replaceByShortType(Tokens $tokens, TypeAnalysis $type, array<string, string> $uses, string $namespaceName) : void
Parameters
$tokens : Tokens
$type : TypeAnalysis
$uses : array<string, string>
$namespaceName : string

resolveSymbol()

Resolve absolute or relative symbol to normalized FQCN.

private resolveSymbol(string $symbol, array<string, string> $uses, string $namespaceName) : string
Parameters
$symbol : string
$uses : array<string, string>
$namespaceName : string
Return values
string

setupUsesFromDiscoveredSymbols()

private setupUsesFromDiscoveredSymbols(array<string, string> &$uses, string $namespaceName) : void
Parameters
$uses : array<string, string>
$namespaceName : string

shortenClassIfPossible()

private shortenClassIfPossible(Tokens $tokens, int $typeStartIndex, int $typeEndIndex, array<string, string> $uses, string $namespaceName) : int
Parameters
$tokens : Tokens
$typeStartIndex : int
$typeEndIndex : int
$uses : array<string, string>
$namespaceName : string
Return values
int

shortenSymbol()

Shorten normalized FQCN as much as possible.

private shortenSymbol(string $fqcn, array<string, string> $uses, string $namespaceName) : string
Parameters
$fqcn : string
$uses : array<string, string>
$namespaceName : string
Return values
string

        
On this page

Search results