Re: [RFC] [VOTE] Allow null and false as stand-alone types
| From: | Côme Chilliet | Date: | Tue, 15 Mar 2022 15:41:45 +0000 |
| Subject: | Re: [RFC] [VOTE] Allow null and false as stand-alone types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117334@lists.php.net to get a copy of this message | ||
Le samedi 12 mars 2022, 19:30:00 CET G. P. B. a écrit :
> true is not a type in PHP compared to false, therefore it is not included.
> I'm working on a proposal to add true as a type to PHP, but that's a
> seperate RFC and discussion.
Was there ever an RFC for adding literal values to the type system?
This would solve all these problems by allowing stuff like:
function foobar(): "foo"|"bar"|true {
}
Côme