Hi internals, Today PHP is more typed than ever, however, one feature is still missing: ability to check complex variable types using standard type declarations.
For example, to check that $var is a nullable string one has to do `assert($var === null || is_string($var))`. To check that $var is false or a countable iterator, one has to write `assert($var === false || ($var instanceof Countable && $var instanceof Iterator))`. I propose to add a new "is" operator that allows to have `assert($var is ?string)` and `assert($var is false|(Countable&Iterator))`. So it is similar to instanceof, but accepts any valid PHP type declaration on the right side. WDYT? Regards, Valentin