Re: intersection types and null for defaults, properties and return types
| From: | Dan Ackroyd | Date: | Mon, 19 Jul 2021 15:18:43 +0000 |
| Subject: | Re: intersection types and null for defaults, properties and return types | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115500@lists.php.net to get a copy of this message | ||
On Mon, 19 Jul 2021 at 16:15, Bruce Weirdan <weirdan@gmail.com> wrote:
>
> On Mon, Jul 19, 2021 at 6:09 PM Dan Ackroyd <Danack@basereality.com> wrote:
>
> > Prediction number 2: Having a null type in the language will happen
> > before PHP 9, which will enable people to have many bike-shedding
> > discussions over ?Bar vs Bar|null.
>
> Hasn't that already happened in 8.0? It seems to work [1]
>
> [1] https://3v4l.org/EfmJq
>
Thanks. Wasn't aware/forgot that - but it's still not usable by
itself, so is a bit of a hack.
https://3v4l.org/LL9UI
function f(): null {
return null;
}
Fatal error: Null can not be used as a standalone type in
Dan
Ack