TypeContextFactory
in package
FinalYes
Creates a type resolving context.
Tags
Table of Contents
Properties
- $extraTypeAliases : array<string|int, mixed>
- $intermediateTypeContextCache : array<string, array<string, TypeContext>>
- $phpstanLexer : Lexer|null
- $phpstanParser : PhpDocParser|null
- $reflectionClassCache : array<class-string, ReflectionClass>
- $stringTypeResolver : StringTypeResolver|null
- $typeContextCache : array<string, array<string, TypeContext>>
Methods
- __construct() : mixed
- createFromClassName() : TypeContext
- createFromReflection() : TypeContext|null
- collectTemplates() : array<string, Type>
- collectTypeAliases() : array<string, Type>
- collectUses() : array<string, string>
- createIntermediateTypeContext() : TypeContext
- createNewInstanceFromClassName() : TypeContext
- getPhpDocNode() : PhpDocNode
- resolveTypeAliases() : array<string, Type>
Properties
$extraTypeAliases read-only
private
array<string|int, mixed>
$extraTypeAliases
= []
$intermediateTypeContextCache
private
array<string, array<string, TypeContext>>
$intermediateTypeContextCache
= []
$phpstanLexer
private
Lexer|null
$phpstanLexer
= null
$phpstanParser
private
PhpDocParser|null
$phpstanParser
= null
$reflectionClassCache
private
static array<class-string, ReflectionClass>
$reflectionClassCache
= []
$stringTypeResolver read-only
private
StringTypeResolver|null
$stringTypeResolver
= null
$typeContextCache
private
array<string, array<string, TypeContext>>
$typeContextCache
= []
Methods
__construct()
public
__construct([StringTypeResolver|null $stringTypeResolver = null ][, array<string, string> $extraTypeAliases = [] ]) : mixed
Parameters
- $stringTypeResolver : StringTypeResolver|null = null
- $extraTypeAliases : array<string, string> = []
createFromClassName()
public
createFromClassName(string $calledClassName[, string|null $declaringClassName = null ]) : TypeContext
Parameters
- $calledClassName : string
- $declaringClassName : string|null = null
Return values
TypeContextcreateFromReflection()
public
createFromReflection(Reflector $reflection) : TypeContext|null
Parameters
- $reflection : Reflector
Return values
TypeContext|nullcollectTemplates()
private
collectTemplates(ReflectionClass|ReflectionFunctionAbstract $reflection, TypeContext $typeContext) : array<string, Type>
Parameters
- $reflection : ReflectionClass|ReflectionFunctionAbstract
- $typeContext : TypeContext
Return values
array<string, Type>collectTypeAliases()
private
collectTypeAliases(ReflectionClass $reflection, TypeContext $typeContext) : array<string, Type>
Parameters
- $reflection : ReflectionClass
- $typeContext : TypeContext
Return values
array<string, Type>collectUses()
private
collectUses(ReflectionClass $reflection) : array<string, string>
Parameters
- $reflection : ReflectionClass
Return values
array<string, string>createIntermediateTypeContext()
private
createIntermediateTypeContext(string $calledClassShortName, ReflectionClass $declaringClassReflection) : TypeContext
Parameters
- $calledClassShortName : string
- $declaringClassReflection : ReflectionClass
Return values
TypeContextcreateNewInstanceFromClassName()
private
createNewInstanceFromClassName(string $calledClassName, string $declaringClassName) : TypeContext
Parameters
- $calledClassName : string
- $declaringClassName : string
Return values
TypeContextgetPhpDocNode()
private
getPhpDocNode(string $rawDocNode) : PhpDocNode
Parameters
- $rawDocNode : string
Return values
PhpDocNoderesolveTypeAliases()
private
resolveTypeAliases(array<string, string> $toResolve, array<string, Type> $resolved, TypeContext $typeContext) : array<string, Type>
Parameters
- $toResolve : array<string, string>
- $resolved : array<string, Type>
- $typeContext : TypeContext