October 1, 2022


Networking, PBX, IT, DIY Solution

The latest progress of PHP 8.2: Alhpa2 has been released and new features will be frozen soon

4 min read

The latest progress of PHP 8.2: Alhpa2 has been released and new features will be frozen soon

The latest progress of PHP 8.2: Alhpa2 has been released and new features will be frozen soon. 

Every month the PHP Foundation blogs about the latest developments in the PHP core of the month.

This article describes progress in June.

QA version and feature freeze for PHP8.2

PHP8.2 is scheduled to be released on November 24, and the PHP version release managers have released the Alpha 1 and Alpha 2 versions of PHP8.2.

These alpha releases are not intended for use in production environments, but are used as release nodes for test environments and local development.

The compiled windows version can be found on https://windows.php.net/qa/ , the Docker image can be found on Docker Hub, the source code is in php/php-src on Github , you can compile it yourself, and it can be found on Homebrew On the PHP 8.2-dev package see instructions from shivammathur/php.

July 19th is the PHP 8.2 feature freeze date, after which PHP 8.2 no longer receives new feature proposals.

New features in PHP have a 2-week discussion period and a 2-week voting period. All RFCs (proposals) must be voted on before a feature freeze.

Updates to RFCs

What’s new in PHP 8.2 from the last PHP arsenal editor ? Some of the new features that have been passed are described in , and now some new features have been voted on, and some are in progress.

Implemented: Allow false and null as separate types

As mentioned in the previous article, some developers are not optimistic about this, thinking that false as an independent type is not useful. Previously false could only be declared jointly with other types.

You can catch an interview with developer George Peter Banyard on the PHP podcast.

https://phpinternals.news/99 , he mentions that a lot of traditional functions return false and throw exceptions internally.

It does not return anything meaningful, and returning false may be to interrupt the execution of the current function code.

So it also makes sense to use false as a standalone return value.

Implemented: allow true as a standalone type

Earlier in the article, I mentioned that false can be used as an independent type (and declared), but true cannot. This proposal proposes to add true as an independent type, making PHP’s type system expressive.

Passed: Random extension 5.x
This is the fifth iteration of the RFC proposed by Go Kudo, improving PHP’s random number generator and moving some of the changes to separate extensions.

Passed: Add deprecation notice for is_callable, and add callable type

PHP will deprecate parts of the is_callable function in the future, but in PHP 8.2 only a deprecation notice will be generated.

The reason for this, simply put, is_callable is syntactically confusing to use. But note that is_callable just abandons the usage of judgment strings, such as is_callable (‘myFunction’), which is still available for other types, such as a variable representing a callback function.

Passed: Disjunctive Normal Form Types

The proposal proposes that PHP support more combinations of type declarations, such as:


That is to say, the value may be null, may be an integer, or may be an object that implements the A interface, the B interface, and the D interface.

See the proposal details for this: https://wiki.php.net/rfc/dnf_types

more RFCs

There are more proposals under discussion, make a simple acceptance and link below.

In discussion: new CURL RUL API (adds curl and url classes)

In discussion: Using enum property values ​​in const declarations

In discussion: subclasses of features in PDO programs (could improve support for sqlite, pgsql)

In discussion: make iterator_*() series accept all iterables (currently only Traversables, but not arrays)

In discussion: Implementing automatic Stringable in enums (but still not custom overrides)

In discussion: short closures (anonymous functions that want to use external variables must use use declarations, short closures can solve such problems (same effect as js arrow functions))


https://thephp.foundation/blog/2022/06/30/php-core-roundup-3/ ,

Copyright © All rights reserved. | Newsphere by AF themes.