Re: [RFC] Mixed type
| From: | Matthew Brown | Date: | Fri, 24 Apr 2020 13:43:15 +0000 |
| Subject: | Re: [RFC] Mixed type | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109826@lists.php.net to get a copy of this message | ||
>
> I'm not as strongly against adding "mixed" to the language as Bob, but I'm
> not convinced I'd ever bother using it.
>
I'm opposed to the use mixed in codebases – I try as best I can to remove
it from any code I come across, and a static analysis tool I've built flags
the use of mixed types whenever a more specific type is preferable. I even
have an opt-in website devoted to tracking the percentage of non-mixed
types in open-source projects, e.g.
https://shepherd.dev/github/sebastianbergmann/phpunit
Nevertheless, I think mixed should be available as a type hint for the
extreme cases mentioned in this thread (e.g. serialisation). A type system
without an explicit mixed type feels incomplete to me.