Check a codebase against PHP 8.4 with PHPCompatibility

PHPCompatibility is a PHP_CodeSniffer standard that turns “how big is this upgrade?” into a list of files and lines. Install it, then point PHPCS at your custom code with the target version.

composer require --dev phpcompatibility/php-compatibility:dev-develop
vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 8.4- app/code

PHPCompatibility 10 needs PHP_CodeSniffer 4. If the project already requires magento/magento-coding-standard (PHPCS 3, with its own older PHPCompatibility fork), the install fails, so run it from a separate tools folder.

The trailing dash in 8.4- means “8.4 and newer”.

Vishwas Bhatnagar

More quick notes

More