class ViewStringTypeNodeResolverExtension implements TypeNodeResolverExtension, TypeNodeResolverAwareExtension

Ensures a 'view-string' type in PHPDoc is recognized to be of type ViewStringType.

Whether a view-string accepts a name depends on which views exist, so what the class whose PHPDoc uses one declares depends on them. PHPStan resolves a type alias in the scope that defines it, not the class using it, so an alias is resolved here to see whether it holds one.

Methods

__construct(ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs, array $typeAliases)

Create a new view-string type node resolver.

Type|null
resolve(TypeNode $typeNode, NameScope $nameScope)

Resolve a view-string PHPDoc type, or a type alias that holds one.

void
setTypeNodeResolver(TypeNodeResolver $typeNodeResolver)

Set the resolver used to resolve type aliases.

Details

at line 43
__construct(ReflectionProvider $reflectionProvider, RuntimeInputs $runtimeInputs, array $typeAliases)

Create a new view-string type node resolver.

Parameters

ReflectionProvider $reflectionProvider
RuntimeInputs $runtimeInputs
array $typeAliases

the global type aliases

at line 54
Type|null resolve(TypeNode $typeNode, NameScope $nameScope)

Resolve a view-string PHPDoc type, or a type alias that holds one.

Parameters

TypeNode $typeNode
NameScope $nameScope

Return Value

Type|null

at line 90
void setTypeNodeResolver(TypeNodeResolver $typeNodeResolver)

Set the resolver used to resolve type aliases.

Parameters

TypeNodeResolver $typeNodeResolver

Return Value

void