| 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
|
getClassReflection(): ClassReflection
The class reflection with the type arguments of this type.
The class reflection with the type arguments of this type.
Overrides
|
#
|
public
|
getStaticObjectType(): ObjectType
|
#
|
public
|
getAncestorWithClassName(string $className): ?TypeWithClassName
The ancestor keeps the type arguments the static object type has for
that class - changeBaseClass() can only carry them down to a subclass.
The ancestor keeps the type arguments the static object type has for
that class - changeBaseClass() can only carry them down to a subclass.
Overrides
|
#
|
public
|
changeBaseClass(ClassReflection $classReflection): StaticType
|
#
|
public
|
isSuperTypeOf(Type $type): IsSuperTypeOfResult
"Does every value of $type belong to $this type?"
"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.
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.
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<int>, 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<int>, infers T = int.
Implements
|
#
|
public
|
getReferencedTemplateTypes(TemplateTypeVariance $positionVariance): array
Returns the template types referenced by this Type, recursively.
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
|
#
|