Le lundi 4 octobre 2021, 10:09:12 CEST Nikita Popov a écrit :
> If we make this change, I would however suggest to also support "false" as
> a standalone type. I think this change primarily has benefits from a
> typesystem completeness perspective rather than a strong practical need.
> From that angle, it would be nice if all types that are usable in a union
> are also usable as standalone types, rather than shifting the special case
> from null to false.

It feels weird/wrong to slowly add values in the type system like this, rather 
than directly supporting static values as type hints.

Why would function a(): null|false {} be legal but function b(): null|0 would 
not?

This is inconsistent to me. And adding null, then false, then true for the sake 
of completeness feels like avoiding to treat the static value as type hint 
subject.

Côme

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to