php 8.0 union type 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