| Methods |
public
|
__construct(int $value)
|
#
|
public
|
getValue(): int
|
#
|
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
|
describe(VerbosityLevel $level): string
|
#
|
public
|
toFloat(): Type
|
#
|
public
|
toAbsoluteNumber(): Type
|
#
|
public
|
toString(): Type
Models the (string) cast.
Models the (string) cast.
Overrides
Implements
|
#
|
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. 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.
Overrides
Implements
|
#
|
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(): ConstTypeNode
|
#
|