Union types | true pseudo-type
| From: | Benjamin Morel | Date: | Mon, 20 Jan 2020 17:30:03 +0000 |
| Subject: | Union types | true pseudo-type | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-108204@lists.php.net to get a copy of this message | ||
Hi internals,
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".
In addition to my Packagist survey
<https://externals.io/message/106844#107304>,
I'd like to point out that I
just came across a native method in the SSH2 extension, that does use true
as a type:
https://www.php.net/manual/en/function.ssh2-auth-none.php
Returns TRUE if the server does accept "none" as an authentication method,
> or an array of accepted authentication methods on failure.
Of course, you could type-hint it array|bool, but the same could be said
for |false.
Thoughts?
— Benjamin