Re: Mixed type-hint
| From: | Marco Pivetta | Date: | Fri, 08 Feb 2019 12:22:59 +0000 |
| Subject: | Re: Mixed type-hint | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104312@lists.php.net to get a copy of this message | ||
On Fri, 8 Feb 2019, 13:13 Robert Korulczyk <robert@korulczyk.pl wrote:
> Sounds like an arbitrary interpretation. Treating `?mixed" as "top type"
> (including null) would be more practical and consistent with other
> type-hints.
>
The PHP ecosystem (libraries) already uses
mixed as a type including
null. You can survey for usages of mixed|null, which is currently
normalised to mixed by existing static analysis tooling (psalm, phpstan).
Even then, by adding a non-nullable almost-top-type doesn't seem helpful:
"here's something random, just make sure it isn't null". That's something
more interesting for an eventual union type RFC (revival?).
Could you clarify on a use-case for changing the semantics of mixed?
>