On 20/01/2020 18:30, Benjamin Morel wrote:
I'd like to bring back the topic of supporting "true" as a type in PHP 8
union types.
Now that the RFC <https://wiki.php.net/rfc/union_types_v2> has been
successfully voted, I'd like to revive the discussion about adding the
"true" pseudo-type in addition to "false".
[..]
Thoughts?
— Benjamin
Hey,
Looking at my current project's code, I found one place where we use a
"string|true" as return type for an authentication method which returns
true or an error code if it fails.
Of course all the use cases we can argue about whether they are valid
and so on, but my main problem is the weird state of having false as a
type and not true. It just feels like an inconsistency in the language
that'll surely bite people when they'll try to use true as a type.
It might not be often, but it's kind of a shame if we can foresee it and
prevent it from happening.
TL;DR: true
Best,
Jordi
--
Jordi Boggiano
@seldaek - https://seld.be
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php