PromotingUnifier implements TypeUnifier
Read onlyYes
FinalYes
Interfaces
Methods
- __construct() : mixed
- 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
__construct()
public
__construct([ScalarUnification $scalars = new ScalarUnification() ][, ContainerUnification $containers = new ContainerUnification() ][, Nullability $nullability = new Nullability() ]) : mixed
Parameters
- $scalars : ScalarUnification = new ScalarUnification()
- $containers : ContainerUnification = new ContainerUnification()
- $nullability : Nullability = new Nullability()
unify()
Pairwise. Called by ContainerUnification at depth >= 1, where nullability composes by OR.
public
unify(Type $left, Type $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 ...$types) : null|Type<string|int, mixed>
$rule is first because PHP requires the variadic last.
Parameters
- $rule : NullabilityRule
- $types : Type