Documentation

NullableTypeDeclarationFixer extends AbstractFixer
in package
implements ConfigurableFixerInterface uses ConfigurableFixerTrait

FinalYes
Tags
author

John Paul E. Balandan, CPA paulbalandan@gmail.com

implements

ConfigurableFixerInterface<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration>

phpstan-type

_AutogeneratedInputConfiguration array{ syntax?: 'question_mark'|'union' }

phpstan-type

_AutogeneratedComputedConfiguration array{ syntax: 'question_mark'|'union' }

Table of Contents

Interfaces

ConfigurableFixerInterface

Constants

OPTION_SYNTAX_QUESTION_MARK  = 'question_mark'
OPTION_SYNTAX_UNION  = 'union'

Properties

$candidateTokenKind  : int

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
configurePostNormalisation()  : void
createConfigurationDefinition()  : FixerConfigurationResolverInterface
collectTypeAnalysis()  : TypeAnalysis|null
convertToExplicitUnionType()  : array<int, string>
convertToNullableType()  : array<int, string>
createTypeDeclarationTokens()  : array<int, Token>
getElements()  : array<int, string>
isTypeNormalizable()  : bool
normalizeMethodArgumentType()  : void
normalizeMethodReturnType()  : void
normalizeNullableType()  : void
normalizePropertyType()  : void

Constants

Properties

Methods

getPriority()

Returns the priority of the fixer.

public getPriority() : int

Must run before OrderedTypesFixer, TypesSpacesFixer. Must run after NullableTypeDeclarationForDefaultNullValueFixer, SingleSpaceAroundConstructFixer.

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

collectTypeAnalysis()

private collectTypeAnalysis(Tokens $tokens, int $startIndex, int $endIndex) : TypeAnalysis|null
Parameters
$tokens : Tokens
$startIndex : int
$endIndex : int
Return values
TypeAnalysis|null

convertToExplicitUnionType()

private convertToExplicitUnionType(string $type) : array<int, string>
Parameters
$type : string
Return values
array<int, string>

convertToNullableType()

private convertToNullableType(string $type) : array<int, string>
Parameters
$type : string
Return values
array<int, string>

createTypeDeclarationTokens()

private createTypeDeclarationTokens(array<int, string> $types, bool $isQuestionMarkSyntax) : array<int, Token>
Parameters
$types : array<int, string>
$isQuestionMarkSyntax : bool
Return values
array<int, Token>

getElements()

private getElements(Tokens $tokens) : array<int, string>
Parameters
$tokens : Tokens
Tags
phpstan-return

array<int, 'function'|'property'>

Return values
array<int, string>

isTypeNormalizable()

private isTypeNormalizable(TypeAnalysis $typeAnalysis) : bool
Parameters
$typeAnalysis : TypeAnalysis
Return values
bool

normalizeMethodArgumentType()

private normalizeMethodArgumentType(FunctionsAnalyzer $functionsAnalyzer, Tokens $tokens, int $index) : void
Parameters
$functionsAnalyzer : FunctionsAnalyzer
$tokens : Tokens
$index : int

normalizeMethodReturnType()

private normalizeMethodReturnType(FunctionsAnalyzer $functionsAnalyzer, Tokens $tokens, int $index) : void
Parameters
$functionsAnalyzer : FunctionsAnalyzer
$tokens : Tokens
$index : int

        
On this page

Search results