union type php code example
Example: php 8 union types
class Number {
public function __construct(
private int|float $number
) {}
}
new Number('NaN'); // TypeError
class Number {
public function __construct(
private int|float $number
) {}
}
new Number('NaN'); // TypeError