Union types in PHP (again), Github RFCs

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.

Find me at

Veselin Kenashkov

Developer at Azonmedia
Loves PHP, frameworks and old computers. Currently interested in Swoole and Vuejs.
Veselin Kenashkov
Find me at

Latest posts by Veselin Kenashkov (see all)

Share if you liked it

Leave a Reply

Your email address will not be published. Required fields are marked *