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