TypeUnifier
Methods
- unify() : null|Type<string|int, mixed>
- Pairwise. Called by ContainerUnification at depth >= 1, where nullability composes by OR.
- unifyAll() : null|Type<string|int, mixed>
- N-ary, and the root entry point every caller uses. Strips every root's nullability, folds the bases under this policy, then re-wraps by $rule read from the original operands.
Methods
unify()
Pairwise. Called by ContainerUnification at depth >= 1, where nullability composes by OR.
public
unify(Type<string|int, mixed> $left, Type<string|int, mixed> $right) : null|Type<string|int, mixed>
Not the root entry point.
Parameters
Return values
null|Type<string|int, mixed> —null = "no common type under this policy" - a value, not an exception
unifyAll()
N-ary, and the root entry point every caller uses. Strips every root's nullability, folds the bases under this policy, then re-wraps by $rule read from the original operands.
public
unifyAll(NullabilityRule $rule, Type<string|int, mixed> ...$types) : null|Type<string|int, mixed>
$rule is first because PHP requires the variadic last.
Parameters
- $rule : NullabilityRule
- $types : Type<string|int, mixed>