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

Most in-demand IT jobs from last decade

Uber for travel, Netflix for leisure and Google for everything is the ideal routine that we all wish to follow, of course with Instagram...

The finest text editor for professional bloggers

It is a fact that blogs have replaced books and magazines due to increasing popularity of the online world. Serious readers subscribe to blogs...

Angular 9 final release released

Angular 9 final is here! The new version was released a little late. Ivy is of course one of the new features, but that's...

VS Code update: New preview features, movable panel and Docker tutorials

The first VS Code update in 2020 was released. In addition to new preview features, parts of the workbench have been revised and the...

Purify: Library for functional programming in TypeScript

The Purify library was developed for functional programming in TypeScript. It should make it possible to use frequently used patterns from functional programming languages...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here