Transpiling PHP code from 8.0 to 7.x via Rector blog.logrocket.com
There is no need to wait for WordPress to bump its minimum PHP version to start using features from PHP 7.4 and 8.0 for our themes and plugins.
There is a tool for PHP, called Rector, which enables to transpile PHP code, similar to how Babel compiles JS to make it compatible with older browsers.
So we can use modern features (such as union types, typed properties, and arrow functions), and deploy it to PHP 7.1.
This article introduces the topic of transpiling in PHP.
Report Article
Recent Comments