| Methods |
public
|
__construct(
ClassReflection $classReflection,
array<int, Type> $types,
?Type $subtractedType,
array<int, TemplateTypeVariance> $variances,
)
|
#
|
public
|
getTypes(): array<int, Type>
|
#
|
public
|
getVariances(): array<int, TemplateTypeVariance>
|
#
|
public
|
getStaticObjectType(): ObjectType
|
#
|
public
|
changeBaseClass(ClassReflection $classReflection): StaticType
|
#
|
public
|
isSuperTypeOf(Type $type): IsSuperTypeOfResult
"Does every value of $type belong to $this type?" Preferable to instanceof checks because it correctly handles
union types, intersection types, and all other composite types.
"Does every value of $type belong to $this type?" Preferable to instanceof checks because it correctly handles
union types, intersection types, and all other composite types.
Overrides
|
#
|
public
|
traverse(callable $cb): Type
Returns a new instance with all inner types mapped through $cb.
Returns the same instance if inner types did not change. Not used directly — use TypeTraverser::map() instead.
Returns a new instance with all inner types mapped through $cb.
Returns the same instance if inner types did not change. Not used directly — use TypeTraverser::map() instead.
Overrides
|
#
|
public
|
traverseSimultaneously(Type $right, callable $cb): Type
Like traverse(), but walks two types simultaneously. Not used directly — use SimultaneousTypeTraverser::map() instead.
Like traverse(), but walks two types simultaneously. Not used directly — use SimultaneousTypeTraverser::map() instead.
Overrides
|
#
|
public
|
changeSubtractedType(?Type $subtractedType): Type
|
#
|
public
|
inferTemplateTypes(Type $receivedType): TemplateTypeMap
Infers the real types of TemplateTypes found in $this, based on
the received Type. E.g. if $this is array<T> and $receivedType
is array, infers T = int.
Infers the real types of TemplateTypes found in $this, based on
the received Type. E.g. if $this is array<T> and $receivedType
is array, infers T = int.
Implements
|
#
|
public
|
getReferencedTemplateTypes(TemplateTypeVariance $positionVariance): array
Returns the template types referenced by this Type, recursively. The return value is a list of TemplateTypeReferences, who contain the
referenced template type as well as the variance position in which it was
found. For example, calling this on array<Foo<T>,Bar> (with T a template type)
will return one TemplateTypeReference for the type T.
Returns the template types referenced by this Type, recursively. The return value is a list of TemplateTypeReferences, who contain the
referenced template type as well as the variance position in which it was
found. For example, calling this on array<Foo<T>,Bar> (with T a template type)
will return one TemplateTypeReference for the type T.
Parameters
| $positionVariance |
The variance position in
which the receiver type was
found.
|
Implements
|
#
|
public
|
toPhpDocNode(): TypeNode
|
#
|
public
|
hasTemplateOrLateResolvableType(): bool
Performance optimization to skip template resolution when no templates are present.
Performance optimization to skip template resolution when no templates are present.
Overrides
|
#
|