General PHP compatibility
Each PHP release adds performance and feature improvements which drive the PHP ecosystem forward. We can only take advantage of PHP improvements if the Magento 2 project builds on these new features and removes support for deprecated PHP features. A few of these changes are significant, requiring us to think about our architectural approach, but many can be implemented without significant impact. For example, even some very specific features introduced in PHP 7.0 such as anonymous classes (new class), generator delegation (yield from), spaceship operator (<=>) have been implemented in the Magento codebase multiple times.
Our focus for the near future is ensuring Magento can take advantage of new PHP versions. To achieve this we need to continuously update Magento dependencies, codebase, and infrastructure.
Most Magento dependencies have already released PHP 8-compatible versions. We have started updating dependency versions while maintaining compatibility with PHP 7.3. After all dependencies are updated, we will be able to install the project on a PHP 8 environment and run tests, which should accelerate updates to the codebase and stabilization activities.
After this work is completed, we will evaluate the number of backward-incompatible changes required and decide if PHP 8 compatibility should be merged to the 2.4-develop or 2.5-develop branch.
Support
The next step is full PHP 8 support. PHP 8 has plenty of new features! Just imagine how Magento code can change for the better using named arguments and how constructor property promotion can simplify the routine of new class declarations. There may be some creative opportunities around bew DOM Traversal and Manipulation APIs, Weak Map, etc.
To be able to utilize new PHP features in our projects, we’ll need to drop PHP 7 compatibility. The decision on when PHP 8 support will be available in Magento will be based on the compatibility project results, PHP version support timeline, and Magento release plans.
Future
We are eager to learn how you think we should use PHP 8 features in the Magento codebase. Share your ideas!
The PHP 8 Compatibility project is open for your propositions and contributions. Check out the project announcement blog post for further details.