Re: [RFC] [VOTE] Allow null and false as stand-alone types

From: Date: Tue, 15 Mar 2022 16:16:03 +0000
Subject: Re: [RFC] [VOTE] Allow null and false as stand-alone types
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-117335@lists.php.net to get a copy of this message
On 15 March 2022 15:41:45 GMT, "Côme Chilliet" <come@chilliet.eu> wrote: >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 { >} It's called enums ;-), so yes! cheers Derick

« previous php.internals (#117335) next »