There has been a new proposal by Nikita Popov about introducing Union types in PHP. There has been a previous proposal which has been rejected.
I think PHP really needs this especially in the light that PHP internal functions have return types that are incompatible with the current type system ( fread() returns string|false). This new proposal is much more detailed than the original and also has the false and mixed types. The mixed type is needed exactly for the reason pointed out by Nikita – it should be used to indicate that the type can be any and not that just someone forgot to put the type declaration.
The new thing here is not just the proposal but also the way the RFC is handled – through Github. This allows for inline comments in the pull request and reactions on the comments. This is very useful for getting a feel of the community as currently in the email discussions if one agrees with someone’s opinion has to send just a one-line email +1.
Veselin Kenashkov
Latest posts by Veselin Kenashkov (see all)
- CentOS roadmap changes already made impact - December 12, 2020
- Docker image with Apache 2.2 and PHP 5.3 - September 26, 2020
- Emulation and virtualization guides - September 24, 2020