Nullability
Read onlyYes
FinalYes
Methods
- all() : Type<string|int, mixed>
- $result, made nullable iff EVERY operand carries a null AND there is at least one.
- any() : Type<string|int, mixed>
- $result, made nullable iff ANY operand carries a null.
- bare() : Type<string|int, mixed>
- Strips exactly one level of nullability. Total - never throws, never null.
- is() : bool
- Nullability has two spellings: OptionalType, and a UnionType containing NullType.
Methods
all()
$result, made nullable iff EVERY operand carries a null AND there is at least one.
public
all(Type<string|int, mixed> $result, Type<string|int, mixed> ...$operands) : Type<string|int, mixed>
Parameters
Return values
Type<string|int, mixed>any()
$result, made nullable iff ANY operand carries a null.
public
any(Type<string|int, mixed> $result, Type<string|int, mixed> ...$operands) : Type<string|int, mixed>
A bare NullType is not a nullable SPELLING - is() answers false, because bare() has no non-null part to return - but on this axis it counts, so the two spellings of a null agree.
Parameters
Return values
Type<string|int, mixed>bare()
Strips exactly one level of nullability. Total - never throws, never null.
public
bare(Type<string|int, mixed> $type) : Type<string|int, mixed>
Unlike Types::reduceOptionals()'s first(), a multi-member nullable union stays a union of its non-null members, so the strip is lossless. Invariant: is(bare($type)) === false, for every $type.
Parameters
- $type : Type<string|int, mixed>
Return values
Type<string|int, mixed>is()
Nullability has two spellings: OptionalType, and a UnionType containing NullType.
public
is(Type<string|int, mixed> $type) : bool
This class is the one place that knows both.
Parameters
- $type : Type<string|int, mixed>