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 Overflow
🌐
JetBrains
jetbrains.com › help › phpstorm › php-8-support.html
PHP 8.0 | PhpStorm Documentation
With the nullsafe operator ?->, you can replace nested null check conditions with chained calls. PhpStorm verifies that the nullsafe operator is not erroneously used in write context or as a reference. Starting with PHP 8, you can catch exceptions without capturing them to variables.
Top answer
1 of 2
18

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.

2 of 2
5
  • 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 :)

Discussions

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.com
🌐 r/PHP
22
13
April 12, 2021
PHP 8.0.0 highlighting (PhpStorm) - Stack Overflow
In PhpStorm I am getting error highlighting after switching to the new PHP 8.0 syntax. My question is: How do I tell PhpStorm to recognise the new syntax of PHP 8.0.0 More on stackoverflow.com
🌐 stackoverflow.com
PHP 8.1 mass compatibility check for upgrades from PHP 7.4
You can try Rector with SetList set to LevelSetList::UP_TO_PHP_81 and run vendor/bin/rector process --dry-run The output will show any upgrades required Some will be optional, for example, a switch to case upgrade. If you want to proceed with the upgrades remove the --dry run. It's possible to upgrade in stages by Ignoring Rules Or Paths More on reddit.com
🌐 r/PHP
26
61
January 5, 2023
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
I think a lot of people who complain about PhpStorm don't understand indexing. They open a new project and it's sooooooooo slow that they immediately give up. They don't realize that once the indexing completes EVERYTHING is sped up. More on reddit.com
🌐 r/PHP
26
12
February 1, 2016
🌐
Reddit
reddit.com › r/php › php 8.1 mass compatibility check for upgrades from php 7.4
r/PHP on Reddit: PHP 8.1 mass compatibility check for upgrades from PHP 7.4
January 5, 2023 -

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

Top answer
1 of 5
36
You can try Rector with SetList set to LevelSetList::UP_TO_PHP_81 and run vendor/bin/rector process --dry-run The output will show any upgrades required Some will be optional, for example, a switch to case upgrade. If you want to proceed with the upgrades remove the --dry run. It's possible to upgrade in stages by Ignoring Rules Or Paths
2 of 5
15
Use the containerization tool of your choice to run your test suite on PHP 8.1 and see what happens. Assuming good test coverage, that's your most reliable check. If you don't have good test coverage, work on that first before you touch anything. While still on 7.4, you can/should do the following: Do all development in E_ALL error level. If you get no notices, you've already resolved the biggest hurdle from 7.4->8.0 (where several notices turned into warnings). Add types. Lots of them. Everywhere you can. That will help flush out a lot of wonky bugs, which PHP 8 is going to poke you about more readily than 7.4 will. Use PHPStan or Psalm at a reasonable level (3-5) to flush out more sloppiness. It may not help with 8.0 compatibility directly, but the kind of things that it coaxes you away from are more likely to have subtle changes that are hard to test for. For instance, it will bug you about using undefined properties, which are 99.9% of the time a bug, and now PHP will harass you about them with a deprecation in 8.2. If you really want to get fancy, use Rector and let it tidy up your code. Basically, "well-behaved" PHP code should upgrade very smoothly. Make sure your code is well-behaved and it should be an easy ride.
🌐
JetBrains
jetbrains.com › help › phpstorm › supported-php-versions.html
Supported PHP versions | PhpStorm Documentation
January 8, 2026 - There is no enforced correlation between the PHP version used in the project and the PHP language level configured in PhpStorm. Although the language version of each interpreter is detected automatically, you can still tell PhpStorm to provide you with coding assistance that corresponds to ...
🌐
GitHub
github.com › PHPCompatibility › PHPCompatibility
GitHub - PHPCompatibility/PHPCompatibility: PHP Compatibility check for PHP_CodeSniffer · GitHub
You should get consistent results independently of the PHP version used in your test environment, though for the best results it is recommended to run the sniffs on a recent PHP version in combination with a recent PHP_CodeSniffer version. As of version 8.0.0, the PHPCompatibility standard can also be used with PHP_CodeSniffer 3.x.
Starred by 2.3K users
Forked by 204 users
Languages   PHP
🌐
JetBrains
blog.jetbrains.com › phpstorm › 2023 › 11 › phpstorm-now-supports-php-8-3
PhpStorm Now Supports PHP 8.3 | The PhpStorm Blog
With PHP 8.3, you can declare types for class constants. PhpStorm supports this feature with intelligent suggestions, type hint completion, and checks for compatibility and redeclaration.
Published   September 17, 2025
🌐
JetBrains
blog.jetbrains.com › phpstorm › 2022 › 10 › phpstorm-2022-3-early-access-3-support-for-php-8-2
PhpStorm 2022.3 Early Access #3: Support for PHP 8.2 | The PhpStorm Blog
January 9, 2024 - Go to Code | Analyze Code | Run Inspection by Name, or use Find Action to quickly find it. Next, search for “dynamic property”, and PhpStorm will do the rest. PHP 8.2 adds support for disjunctive normal form types, as well as standalone ...
🌐
LinuxBlog
linuxblog.io › home › php 8 compatibility check and performance tips
PHP 8 Compatibility Check and Performance Tips
November 11, 2024 - There are some tools available that automate the process of checking your scripts for PHP 8 compatibility. Here is a couple that I can recommend. ... PHP Compatibility checker for PHP_CodeSniffer. PHP-Parallel-Lint checks the syntax of PHP files. There’s also PHPStorm for developers.
Find elsewhere
🌐
Adobe
experienceleague.adobe.com › en › docs › commerce-learn › tutorials › upgrade › uct-phpstorm
Using the Upgrade Compatibility Tool on PHP Storm | Adobe Commerce
December 10, 2025 - You can easily navigate through the files by clicking the link and jumping to the specific line in order to fix whatever is needed to be compatible with the target version. This seems really useful, right? Then let me show inspections in real time. You need to configure the UCT inspections through your PhpStorm preferences, go to editor inspections. To do so, I will create a separate profile just to inspect the UCT issues. Once I have this profile ready, I will simply enable the checks for the UCT.
🌐
Laravel News
laravel-news.com › home › phpstorm 2020.3 is here with support for php 8 and tailwind css
PhpStorm 2020.3 is here with support for PHP 8 and Tailwind CSS - Laravel News
December 3, 2020 - The IDE will also support various custom PHP 8 attributes out of the box. For example, with the #[Immutable] attribute on a class or property, PhpStorm will check the usage of objects and mark change attempts as invalid:
🌐
Peterfisher
peterfisher.me.uk › blog › how-to-check-if-your-code-is-compatible-with-php-8
How to check if your code is compatible with PHP 8 | Peter Fisher
PHPCs can be used to check if your code base is compatible with a different version on PHP. This is very handy if you want to check if your project can be upgraded to PHP 7.4 or 8.1
🌐
Daniel Opitz
odan.github.io › 2020 › 12 › 22 › php8-compatibility-check.html
PHP 8 Compatibility Check | Daniel Opitz - Blog
December 22, 2020 - "scripts": { "sniffer:php8": "phpcs -p ./src --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.2" } To check your codebase for PHP 8.2 compatibility issues execute the script as follows:
🌐
Atatus
atatus.com › blog › tools-to-check-php8-compatibility › amp
Tools to Check PHP 8 Compatibility & Performance Tips
March 28, 2025 - This application can be used with PHP 5.3 to 8.1. Install with composer as a development dependency: composer require --dev php-parallel-lint/php-parallel-lint · If you want coloured output, install PHP Parallel Lint with console highlighter ...
🌐
Reddit
reddit.com › r/php › what is a good tool to check codebase compatibility with php 8?
r/PHP on Reddit: What is a good tool to check codebase compatibility with PHP 8?
April 12, 2021 -

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!

🌐
JetBrains
blog.jetbrains.com › phpstorm › tag › php-8
PHP 8 : The PhpStorm Blog | The JetBrains Blog
April 22, 2020 - Greetings everyone, Please welcome the August installment of PHP Annotated! PHP 8 has reached feature freeze and received a few last big additions: the nullsafe operator, named arguments, and saner string to number comparison. The syntax for attributes, though, has not yet been decided. Read t… ... PhpStorm 2020.2 is now available!