| Methods |
public
|
__construct(string $value, bool $isClassString = false)
|
#
|
public
|
getValue(): string
|
#
|
public
|
getConstantStrings(): array
|
#
|
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.
Overrides
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.
Overrides
Implements
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
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
|
isCallable(): TrinaryLogic
|
#
|
public
|
getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope): array
|
#
|
public
|
toNumber(): Type
Models numeric coercion for arithmetic operators.
Models numeric coercion for arithmetic operators.
Overrides
Implements
|
#
|
public
|
toBitwiseNotType(): Type
Models the bitwise-not (~$x) operator. Returns ErrorType for types where ~ is undefined.
Models the bitwise-not (~$x) operator. Returns ErrorType for types where ~ is undefined.
Overrides
Implements
|
#
|
public
|
toObjectTypeForInstanceofCheck(): ClassNameToObjectTypeResult
Projects a class-name-or-object Type (the right-hand side of
$x instanceof <expr>) to the ObjectType it should be compared
against. Constant class strings collapse to their ObjectType
exactly; everything kept symbolically (object class names,
class-string<X>) carries an uncertainty flag so the caller can
fall back to BooleanType instead of a definite yes/no.
Projects a class-name-or-object Type (the right-hand side of
$x instanceof <expr>) to the ObjectType it should be compared
against. Constant class strings collapse to their ObjectType
exactly; everything kept symbolically (object class names,
class-string<X>) carries an uncertainty flag so the caller can
fall back to BooleanType instead of a definite yes/no.
Implements
|
#
|
public
|
toObjectTypeForIsACheck(Type $objectOrClassType, bool $allowString, bool $allowSameClass): ClassNameToObjectTypeResult
Projects a class-name-or-object Type (the second argument of
is_a($x, $class, $allow_string)) to the ObjectType to narrow
$x against. When $allowString is true, the is_a() result also
keeps the original class-string accepted alongside the object.
$allowSameClass controls whether matching the input's own class
collapses to NeverType for final classes (the call site's
"always-true" suppression).
Projects a class-name-or-object Type (the second argument of
is_a($x, $class, $allow_string)) to the ObjectType to narrow
$x against. When $allowString is true, the is_a() result also
keeps the original class-string accepted alongside the object.
$allowSameClass controls whether matching the input's own class
collapses to NeverType for final classes (the call site's
"always-true" suppression).
Implements
|
#
|
public
|
toAbsoluteNumber(): Type
|
#
|
public
|
toInteger(): Type
|
#
|
public
|
toFloat(): 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.
Overrides
Implements
|
#
|
public
|
isString(): TrinaryLogic
|
#
|
public
|
isNumericString(): TrinaryLogic
|
#
|
public
|
isDecimalIntegerString(): TrinaryLogic
When isDecimalIntegerString() returns yes(), the type
is guaranteed to be cast to an integer in an array key.
Examples of constant values covered by this type: "0", "1", "1234", "-1" When isDecimalIntegerString() returns no(), the type represents strings containing non-decimal integers and other text.
These are guaranteed to stay as string in an array key.
Examples of constant values covered by this type: "+1", "00", "18E+3", "1.2", "1,3", "foo"
When isDecimalIntegerString() returns yes(), the type
is guaranteed to be cast to an integer in an array key.
Examples of constant values covered by this type: "0", "1", "1234", "-1" When isDecimalIntegerString() returns no(), the type represents strings containing non-decimal integers and other text.
These are guaranteed to stay as string in an array key.
Examples of constant values covered by this type: "+1", "00", "18E+3", "1.2", "1,3", "foo"
Overrides
Implements
|
#
|
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.
Overrides
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.
Overrides
Implements
|
#
|
public
|
isLowercaseString(): TrinaryLogic
|
#
|
public
|
isUppercaseString(): TrinaryLogic
|
#
|
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).
Overrides
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.
Overrides
Implements
|
#
|
public
|
append(self $otherString): self
|
#
|
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
|
getSmallerType(PhpVersion $phpVersion): Type
Type narrowing methods for comparison operators.
For example, for ConstantIntegerType(5), getSmallerType() returns int<min, 4>.
Type narrowing methods for comparison operators.
For example, for ConstantIntegerType(5), getSmallerType() returns int<min, 4>.
Implements
|
#
|
public
|
getSmallerOrEqualType(PhpVersion $phpVersion): Type
|
#
|
public
|
getGreaterType(PhpVersion $phpVersion): Type
|
#
|
public
|
getGreaterOrEqualType(PhpVersion $phpVersion): Type
|
#
|
public
|
canAccessConstants(): TrinaryLogic
|
#
|
public
|
hasConstant(string $constantName): TrinaryLogic
|
#
|
public
|
getConstant(string $constantName): ClassConstantReflection
|
#
|
public
|
toPhpDocNode(): TypeNode
|
#
|