You have two options here, which depend on each other.
Install PHP_CodeSniffer
To check your project for 7.2 compatibility I recommend the PHP CodeSniffer. This is a little yet powerful command line program which statically checks your code against predefined coding standards.
Install it via Composer from within your the root level of your project:
$ composer require --dev squizlabs/php_codesniffer
You can also install it globally or as a Phar. Please consult the documentation for alternate installation methods.
Once installed, you can call it via:
$ vendor/bin/phpcs --version // This outputs you the version
As mentioned above, PHPCS comes with ready to use coding standards. Use
$ vendor/bin/phpcs -i to list them.
To check if your code is PSR-2 compatible run:
$ vendor/bin/phpcs --standard=PSR2 .
As you like to check your project for PHP 7.2 compatibility, you have to install this standard: https://github.com/PHPCompatibility/PHPCompatibility
$ composer require --dev phpcompatibility/php-compatibility
Now register the standard in PHPCS. Open your composer.json and add this lines to the scripts section:
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}
This will take care if you install/update your dependencies. To register the standard right now, you have to call the script manually:
$ composer run-script post-install-cmd
To check if the new standard is successfully installed run:
$ vendor/bin/phpcs -i
Now you are able to run the check from the cli:
$ vendor/bin/phpcs -p . --standard=PHPCompatibility
Configure PhpStorm to use PHP_CodeSniffer
As you already have configured the PHP Interpreter in PhpStorm, open your Preferences and to to PHP | Quality Tools | CodeSniffer. Click on the ... and type the path to your PHP_CodeSniffer installation. In our case vendor/bin/phpcs and hit Validate. It shows an tooltip with the current version.

Now click on OK.
Enable the Inspections
Inside the Preferences go to Editor | Inspections | PHP | Quality tools. Enable the PHP Code Sniffer validation checkbox. Then to the right you find the settings page. You have to select the PHPCompatibility standard from the select field and hit the reload button next to the select. Once done, click OK.
You should now see the errors inside the editor underlined. The severity and the color can be set in the configuration pane we just closed.

Conclusion
Now you have two ways to check your projects code. The CLI-way gives you a better overall overview about the state of your code where the IDE-way can help you while coding to be aware of not using old language constructs.
Answer from common sense on Stack OverflowYou have two options here, which depend on each other.
Install PHP_CodeSniffer
To check your project for 7.2 compatibility I recommend the PHP CodeSniffer. This is a little yet powerful command line program which statically checks your code against predefined coding standards.
Install it via Composer from within your the root level of your project:
$ composer require --dev squizlabs/php_codesniffer
You can also install it globally or as a Phar. Please consult the documentation for alternate installation methods.
Once installed, you can call it via:
$ vendor/bin/phpcs --version // This outputs you the version
As mentioned above, PHPCS comes with ready to use coding standards. Use
$ vendor/bin/phpcs -i to list them.
To check if your code is PSR-2 compatible run:
$ vendor/bin/phpcs --standard=PSR2 .
As you like to check your project for PHP 7.2 compatibility, you have to install this standard: https://github.com/PHPCompatibility/PHPCompatibility
$ composer require --dev phpcompatibility/php-compatibility
Now register the standard in PHPCS. Open your composer.json and add this lines to the scripts section:
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}
This will take care if you install/update your dependencies. To register the standard right now, you have to call the script manually:
$ composer run-script post-install-cmd
To check if the new standard is successfully installed run:
$ vendor/bin/phpcs -i
Now you are able to run the check from the cli:
$ vendor/bin/phpcs -p . --standard=PHPCompatibility
Configure PhpStorm to use PHP_CodeSniffer
As you already have configured the PHP Interpreter in PhpStorm, open your Preferences and to to PHP | Quality Tools | CodeSniffer. Click on the ... and type the path to your PHP_CodeSniffer installation. In our case vendor/bin/phpcs and hit Validate. It shows an tooltip with the current version.

Now click on OK.
Enable the Inspections
Inside the Preferences go to Editor | Inspections | PHP | Quality tools. Enable the PHP Code Sniffer validation checkbox. Then to the right you find the settings page. You have to select the PHPCompatibility standard from the select field and hit the reload button next to the select. Once done, click OK.
You should now see the errors inside the editor underlined. The severity and the color can be set in the configuration pane we just closed.

Conclusion
Now you have two ways to check your projects code. The CLI-way gives you a better overall overview about the state of your code where the IDE-way can help you while coding to be aware of not using old language constructs.
- Open "Settings"
- Search for "Languages & Frameworks"
- Under PHP, choose "Composer"
- Deslect "Synchronize IDE Settings with composer.json"
- Choose PHP
- Set "PHP language level" to 7.2
Enjoy :)
What is a good tool to check codebase compatibility with PHP 8?
Do what our cto did, just put v8 on the server and composer, push and see what smells bad.
What a fun week that was.
More on reddit.comPHP 8.0.0 highlighting (PhpStorm) - Stack Overflow
PHP 8.1 mass compatibility check for upgrades from PHP 7.4
Where's all the evidence that PHPStorm eats up memory? I'm on PHPStorm 10 on a MacBook w/8GB Ram installed and it doesn't seem to take more than 800-900 MB and most of that is just reserved
Hi, I have a server to migrate from PHP 7.4 to PHP 8.1 and I would like to be sure in advance that the codebases are compatible and that they are not affected by deprecations, breaking changes or similar.
However, I can't find a reliable tool to automatically and massively verify the codebases.
I'm using the latest version of PHPStorm - is there a way to run a code scan for incompatible or problematic code? Can't seem to find a way, if I set language level to PHP 8.1 I can see the warnings when I'm working on a single file, but I can't find the way to scan the whole project only for these types of inspections.
I also tried with squizlabs/php_codesniffer and phpcompatibility/php-compatibility but many deprecations are not detected (e.g. Optional parameter <parameter> declared before required parameter).
What tips do you have for doing a thorough check?
Thank you very much in advance
Hello,
I have legacy-ish codebase (largely updated and working with PHP 7.4) and I would like to check it for compatibility with PHP 8, however I've yet to find a reliable tool for the job. My current search has taken me to:
- phpCompatibility (https://github.com/PHPCompatibility/PHPCompatibility) works with PHPCs, but seems that targeting PHP8 is a mixed bag (judging by issues that mention some check as WIP)
- Phan (https://github.com/phan/phan) seems that it can check for backward compatibility but I've yet to find a way to configure it for forward-compatibility
Next steps:
- Rector
Has anyone used these or something else to prepare for upgrades to PHP 8 as of yet? I'd appreciate any hints.
Thanks!
Do what our cto did, just put v8 on the server and composer, push and see what smells bad.
What a fun week that was.
I very recently migrated a decent-sized legacy project from 7.2 to 8.0 using Rector and can definitely recommend it. The best part about Rector is that it can be used to either partially or fully automate the migration, as well as handle a lot of other things besides the version compatibility (e.g. identifying dead code blocks).
Go to settings (Ctrl + Alt + S) -> Languages & Frameworks -> PHP and change php language level to your wished php version. You could also set path to cli interpreter if you want

As mentioned by Urmat Zhenaliev in the previous post, the EAP version is always up-to-date with the newest version releases of supported programming languages.
So for a developer that wants to program bleeding edge technology it is wise to think about EAP (early access program/releases) installations