| Methods |
public
|
__construct(string $className, string $enumCaseName, ?ClassReflection $classReflection = null)
|
#
|
public
|
getEnumCaseName(): string
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
public
|
equals(Type $type): bool
|
#
|
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
|
subtract(Type $type): Type
|
#
|
public
|
getTypeWithoutSubtractedType(): Type
|
#
|
public
|
changeSubtractedType(?Type $subtractedType): Type
|
#
|
public
|
getSubtractedType(): ?Type
|
#
|
public
|
tryRemove(Type $typeToRemove): ?Type
|
#
|
public
|
getUnresolvedPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
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
|
hasStaticProperty(string $propertyName): TrinaryLogic
|
#
|
public
|
getStaticProperty(string $propertyName, ClassMemberAccessAnswerer $scope): ExtendedPropertyReflection
|
#
|
public
|
getUnresolvedStaticPropertyPrototype(
string $propertyName,
ClassMemberAccessAnswerer $scope,
): UnresolvedPropertyPrototypeReflection
|
#
|
public
|
getBackingValueType(): ?Type
|
#
|
public
|
generalize(GeneralizePrecision $precision): Type
Removes constant value information. E.g. 'foo' -> string, 1 -> int.
Used when types become too complex to track precisely (e.g. loop iterations).
Removes constant value information. E.g. 'foo' -> string, 1 -> int.
Used when types become too complex to track precisely (e.g. loop iterations).
Implements
|
#
|
public
|
isSmallerThan(Type $otherType, PhpVersion $phpVersion): TrinaryLogic
|
#
|
public
|
isSmallerThanOrEqual(Type $otherType, PhpVersion $phpVersion): TrinaryLogic
|
#
|
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.
Overrides
|
#
|
public
|
getClassStringType(): Type
Return class-string<Foo> for object type Foo.
Return class-string<Foo> for object type Foo.
Overrides
|
#
|
public
|
toClassConstantType(ReflectionProvider $reflectionProvider): Type
Models the type of $x::class. For known final classes the literal
class name is returned; for everything else an
IntersectionType[ClassString<X>, AccessoryLiteralStringType].
NullType passes through (mirrors PHP's nullsafe ::class semantics).
ReflectionProvider is needed for the final-class lookup.
Models the type of $x::class. For known final classes the literal
class name is returned; for everything else an
IntersectionType[ClassString<X>, AccessoryLiteralStringType].
NullType passes through (mirrors PHP's nullsafe ::class semantics).
ReflectionProvider is needed for the final-class lookup.
Overrides
|
#
|
public
|
toPhpDocNode(): TypeNode
|
#
|