Test If Your Magento Site Is Php7 Ready
Mar 2, 2017 · 1 minute readCategory: static analysis
After you’ve installed the Inchoo PHP7 module you’ll likely want to check if your custom or 3rd party module code is also PHP7 compatible. In order to determine this you can run a static analysis.
PHPCodeSniffer
PHPCodeSniffer is a PHP static analysis tool which can be used to test your code against a set of coding standards.
PHPCompatibility
PHPCompatibility is a coding standard which you can use to test if your code is compatible with a certain (or range of) PHP versions. In our case we’re only interested in PHP7.
Running the Analysis
Once you’ve install both PHPCodeSniffer and PHPCompatibility (by following the instructions on their respective GitHub pages) we should be ready to run our analysis.
Use the following command to run your analysis:
./vendor/bin/phpcs -p --standard=PHPCompatibility --runtime-set testVersion 7.0
As the command is running you should see a summary of the tested files. W
means warning and E
means error.
After the command has run you should see a detailed list of all the potential compatibility issues.
Once these have been fixed or mitigated you should be ready for PHP7.