| Methods |
public
|
__construct(array<int|string, Type> $properties, list<int|string> $optionalProperties)
|
#
|
public
|
getProperties(): array<int|string, Type>
|
#
|
public
|
getOptionalProperties(): list<int|string>
|
#
|
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.).
Implements
|
#
|
public
|
getObjectClassNames(): array
Returns class names of the object types this type directly represents.
Unlike getReferencedClasses(), excludes classes in generic arguments, etc.
Returns class names of the object types this type directly represents.
Unlike getReferencedClasses(), excludes classes in generic arguments, etc.
Implements
|
#
|
public
|
getObjectClassReflections(): array
|
#
|
public
|
hasProperty(string $propertyName): TrinaryLogic
|
#
|
public
|
getProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
public
|
hasInstanceProperty(string $propertyName): TrinaryLogic
|
#
|
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.
Implements
|
#
|
public
|
hasStaticProperty(string $propertyName): TrinaryLogic
|
#
|
public
|
getStaticProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedStaticPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
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.
Implements
|
#
|
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.
Implements
|
#
|
public
|
equals(Type $type): bool
|
#
|
public
|
tryRemove(Type $typeToRemove): ?Type
|
#
|
public
|
makePropertyRequired(string $propertyName): self
|
#
|
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
|
describe(VerbosityLevel $level): string
|
#
|
public
|
getEnumCases(): array
|
#
|
public
|
getEnumCaseObject(): ?EnumCaseObjectType
Returns the single enum case this type represents, or null if not exactly one case.
Returns the single enum case this type represents, or null if not exactly one case.
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.
Implements
|
#
|
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.
Implements
|
#
|
public
|
exponentiate(Type $exponent): Type
|
#
|
public
|
getFiniteTypes(): array
Returns a list of finite values this type can take. Examples: - for bool: [true, false]
- for int<0, 3>: [0, 1, 2, 3]
- for enums: list of enum cases
- for scalars: the scalar itself For infinite types it returns an empty array.
Returns a list of finite values this type can take. Examples: - for bool: [true, false]
- for int<0, 3>: [0, 1, 2, 3]
- for enums: list of enum cases
- for scalars: the scalar itself For infinite types it returns an empty array.
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.
Implements
|
#
|