Re: [RFC] Mixed type

From: Date: Tue, 21 Apr 2020 12:26:24 +0000
Subject: Re: [RFC] Mixed type
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-109751@lists.php.net to get a copy of this message
On Tue, Apr 21, 2020 at 11:10 AM Côme Chilliet <come.chilliet@fusiondirectory.org> wrote: > > Le lundi 20 avril 2020, 09:15:24 CEST Sara Golemon a écrit : > > use mixed = null|bool|int|float|string|array|object|resource; > > use scalar = null|bool|int|float|string; > > I’m wondering if null should maybe be left out of these, since ?mixed and ?scalar can be used > for this? For mixed, this has been discussed several times, it's defined as the union of *all* value types (void aside), *including* null, according to its usage in phpDoc (and in Hack, which also has a nonnull type such that mixed is equivalent to ?nonnull, cf https://docs.hhvm.com/hack/types/nullable-types). For scalar, I already replied (https://externals.io/message/109715#109723) that it should not include null indeed (according to https://www.php.net/manual/en/language.types.intro.php and https://www.php.net/manual/en/function.is-scalar.php). -- Guilliam Xavier

« previous php.internals (#109751) next »