PHP 8.0: Vote on Union Types ended

PHP 8.0 is scheduled for 2020. Recently, the PHP development team in PHP Internals voted on Union Types as a new feature for PHP. We look at the result of the vote.

Recently, the PHP core team in Internals called for a vote on Union Types as a new feature for PHP 8.0 ( we reported ). Already in June 2016 there was such a voting for PHP 7.1. At that time, however , the proposal was rejected . Now the results of the second vote on Union Types are available.

PHP 8.0: The results of the vote on Union Types

Voting took place via the PHP Wiki in the PHP RFC: Union Types 2.0. Until November 8, 2019, the new feature for PHP could be tuned here. Now we have the results. With 61 to 5 votes Union Types for PHP 8.0 were decided. The result provides enthusiasm in the PHP Internals :

Congratulations on passing a fantastic RFC.

On a contrary level, I think the 61-5 outcome is a fairly huge endorsement from internals on the importance of typing in PHP.

Mark Randall

Union Types for PHP

Thus, it is clear that Union Types will be part of the feature list for the upcoming PHP version release in 2020. In the future, Union Types should be specified with the syntax T1|T2|… In addition, they should be able to be used in any position in which types are currently accepted. The RFC contains a sample code:

class Number {
     private int|float $number;

     public function setNumber(int|float $number): void {
        $this->number = $number;

     public function getNumber(): int|float {
        return $this->number;

More information on voting and Union Types can be found on GitHub .

Recent Articles


Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here