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

Frontend Tools 2019 survey: jQuery Threatened

Frontend Tools 2019 survey showed that React is voted the most important as well as the most widely used JavaScript tool. For the first...

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....

Angular 9 Next versions: Bazel Schematics switched to Ivy

With Angular 9 next versions, the upcoming major version of the JavaScript framework has again received a number of feature updates, notably the innovations...

HP enters strategic partnership with ExpressVPN to increase security offerings on consumer laptops

In light of the recent challenges faced by the cryptocurrency space and the technological sphere at large, security has become a serious issue among...

Node.js 12.12: New flag for easier electron integration

Node.js 12.12 is here to bring a new flag to help work with embedders like Electron. In addition, source maps are now available for...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here