| Methods |
public
|
__construct(bool $value)
|
#
|
public
|
getValue(): bool
|
#
|
public
|
describe(VerbosityLevel $level): string
|
#
|
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
|
toBoolean(): BooleanType
|
#
|
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
|
toAbsoluteNumber(): Type
|
#
|
public
|
toString(): Type
Models the (string) cast.
Models the (string) cast.
Overrides
Implements
|
#
|
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
|
toCoercedArgumentType(bool $strictTypes): Type
Returns how this type might change when passed to a typed parameter
or assigned to a typed property.
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.
Overrides
Implements
|
#
|
public
|
isTrue(): TrinaryLogic
|
#
|
public
|
isFalse(): TrinaryLogic
|
#
|
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
|
toPhpDocNode(): TypeNode
|
#
|
public
|
toNativePhpTypeNode(NativeTypePosition $position)
The native PHP type declaration for this type at the given position,
widened to what the position allows, e.g. non-empty-string to string.
Returns null when the type cannot be declared natively there.
The native PHP type declaration for this type at the given position,
widened to what the position allows, e.g. non-empty-string to string.
Returns null when the type cannot be declared natively there.
Overrides
Implements
|
#
|
public
|
looseCompare(Type $type, PhpVersion $phpVersion): BooleanType
|
#
|