| Methods |
public
|
__construct(
string $mainType,
array<int, Type> $types,
?Type $subtractedType = null,
?ClassReflection $classReflection = null,
array<int, TemplateTypeVariance> $variances = [],
)
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
public
|
equals(Type $type): bool
|
#
|
public
|
getReferencedClasses(): array
Returns all class names referenced anywhere in this type, recursively
(including generic arguments, callable signatures, etc.).
Returns all class names referenced anywhere in this type, recursively
(including generic arguments, callable signatures, etc.).
Overrides
|
#
|
public
|
getTypes(): array<int, Type>
|
#
|
public
|
getVariances(): array<int, TemplateTypeVariance>
|
#
|
public
|
accepts(Type $type, bool $strictTypes): AcceptsResult
Unlike isSuperTypeOf(), accepts() takes into account PHP's implicit type coercion.
With $strictTypes = false, int is accepted by float, and Stringable objects are
accepted by string.
Unlike isSuperTypeOf(), accepts() takes into account PHP's implicit type coercion.
With $strictTypes = false, int is accepted by float, and Stringable objects are
accepted by string.
Overrides
|
#
|
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
|
getClassReflection(): ?ClassReflection
|
#
|
public
|
getProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
public
|
getInstanceProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedInstancePropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
Unlike getInstanceProperty(), this defers template type resolution.
Use getInstanceProperty() in most rule implementations.
Unlike getInstanceProperty(), this defers template type resolution.
Use getInstanceProperty() in most rule implementations.
Overrides
|
#
|
public
|
getStaticProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedStaticPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
public
|
getMethod(string $methodName, ClassMemberAccessAnswerer $scope): ExtendedMethodReflection
|
#
|
public
|
getUnresolvedMethodPrototype(string $methodName, ClassMemberAccessAnswerer $scope): UnresolvedMethodPrototypeReflection
Unlike getMethod(), this defers template type and static type resolution.
Use getMethod() in most rule implementations.
Unlike getMethod(), this defers template type and static type resolution.
Use getMethod() in most rule implementations.
Overrides
|
#
|
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
|
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
|
#
|
protected
|
recreate(string $className, Type[] $types, ?Type $subtractedType, TemplateTypeVariance[] $variances = []): self
|
#
|
public
|
changeSubtractedType(?Type $subtractedType): Type
|
#
|
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
|
#
|