| Methods |
public
|
__construct()
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
public
|
getConstantStrings(): array
|
#
|
public
|
isOffsetAccessible(): TrinaryLogic
|
#
|
public
|
isOffsetAccessLegal(): TrinaryLogic
Whether accessing a non-existent offset is safe (won't cause errors).
Unlike isOffsetAccessible() which checks if offset access is supported at all.
Whether accessing a non-existent offset is safe (won't cause errors).
Unlike isOffsetAccessible() which checks if offset access is supported at all.
Implements
|
#
|
public
|
hasOffsetValueType(Type $offsetType): TrinaryLogic
|
#
|
public
|
getOffsetValueType(Type $offsetType): Type
|
#
|
public
|
setOffsetValueType(?Type $offsetType, Type $valueType, bool $unionValues = true): Type
May add a new key. When $offsetType is null, appends (like $a[] = $value).
May add a new key. When $offsetType is null, appends (like $a[] = $value).
Overridden by
Implements
|
#
|
public
|
setExistingOffsetValueType(Type $offsetType, Type $valueType): Type
Unlike setOffsetValueType(), assumes the key already exists.
Preserves the array shape and list type.
Unlike setOffsetValueType(), assumes the key already exists.
Preserves the array shape and list type.
Overridden by
Implements
|
#
|
public
|
unsetOffset(Type $offsetType): Type
|
#
|
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.
Overridden by
Implements
|
#
|
public
|
toNumber(): Type
Models numeric coercion for arithmetic operators.
Models numeric coercion for arithmetic operators.
Overridden by
Implements
|
#
|
public
|
toAbsoluteNumber(): Type
|
#
|
public
|
toInteger(): Type
|
#
|
public
|
toFloat(): Type
|
#
|
public
|
toString(): Type
Models the (string) cast.
Models the (string) cast.
Implements
|
#
|
public
|
toArray(): Type
|
#
|
public
|
toArrayKey(): Type
Models PHP's implicit array key coercion: floats truncated to int,
booleans become 0/1, null becomes '', numeric strings become int.
Models PHP's implicit array key coercion: floats truncated to int,
booleans become 0/1, null becomes '', numeric strings become int.
Overridden by
Implements
|
#
|
public
|
toCoercedArgumentType(bool $strictTypes): Type
Returns how this type might change when passed to a typed parameter
or assigned to a typed property. With $strictTypes = true: int widens to int|float (since int is accepted
by float parameters in strict mode).
With $strictTypes = false: additional coercions apply, e.g. Stringable
objects are accepted by string parameters. Used internally to determine what types a value might be coerced to
when checking parameter acceptance.
Returns how this type might change when passed to a typed parameter
or assigned to a typed property. With $strictTypes = true: int widens to int|float (since int is accepted
by float parameters in strict mode).
With $strictTypes = false: additional coercions apply, e.g. Stringable
objects are accepted by string parameters. Used internally to determine what types a value might be coerced to
when checking parameter acceptance.
Implements
|
#
|
public
|
isNull(): TrinaryLogic
|
#
|
public
|
isTrue(): TrinaryLogic
|
#
|
public
|
isFalse(): TrinaryLogic
|
#
|
public
|
isBoolean(): TrinaryLogic
|
#
|
public
|
isFloat(): TrinaryLogic
|
#
|
public
|
isInteger(): TrinaryLogic
|
#
|
public
|
isString(): TrinaryLogic
|
#
|
public
|
isNumericString(): TrinaryLogic
|
#
|
public
|
isNonEmptyString(): TrinaryLogic
|
#
|
public
|
isNonFalsyString(): TrinaryLogic
Non-falsy string is a non-empty string that is also not '0'.
Stricter subset of non-empty-string.
Non-falsy string is a non-empty string that is also not '0'.
Stricter subset of non-empty-string.
Overridden by
Implements
|
#
|
public
|
isLiteralString(): TrinaryLogic
A literal-string is a string composed entirely from string literals
in the source code (not from user input). Used for SQL injection prevention.
A literal-string is a string composed entirely from string literals
in the source code (not from user input). Used for SQL injection prevention.
Overridden by
Implements
|
#
|
public
|
isLowercaseString(): TrinaryLogic
|
#
|
public
|
isUppercaseString(): TrinaryLogic
|
#
|
public
|
isClassString(): TrinaryLogic
|
#
|
public
|
getClassStringObjectType(): Type
Returns the object type for a class-string or literal class name string.
For non-class-string types, returns ErrorType.
Returns the object type for a class-string or literal class name string.
For non-class-string types, returns ErrorType.
Overridden by
Implements
|
#
|
public
|
getObjectTypeOrClassStringObjectType(): Type
Like getClassStringObjectType(), but also returns object types as-is.
Used for $classOrObject::method() where the left side can be either.
Like getClassStringObjectType(), but also returns object types as-is.
Used for $classOrObject::method() where the left side can be either.
Overridden by
Implements
|
#
|
public
|
isScalar(): TrinaryLogic
|
#
|
public
|
looseCompare(Type $type, PhpVersion $phpVersion): BooleanType
|
#
|
public
|
hasMethod(string $methodName): TrinaryLogic
|
#
|
public
|
tryRemove(Type $typeToRemove): ?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
|
exponentiate(Type $exponent): 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.
Overridden by
Implements
|
#
|