So, you mean to highlight all pieces of code that will not work with the PHP version you are writing it in, right? That can be done here:

Preferences -> Languages & Frameworks > PHP

and the same on Mac:

PhpStorm -> Preferences (⌘,) -> Languages & Frameworks > PHP

Or with newer versions of PhpStorm in Windows:

File -> Settings -> Languages & Frameworks > PHP

then select your PHP version, for example, 7.0

This is very useful when your local system runs PHP 7.0, for example, but production is running PHP 5.5.

That way PhpStorm will warn you which parts will not work in production, show proper hints during writing code according to the selected version, etc.

Answer from Alejandro Moreno on Stack Overflow
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 115000773864-phpStorm-resets-PHP-language-level-after-restart
phpStorm resets PHP language level after restart – IDEs Support (IntelliJ Platform) | JetBrains
To people experiencing this problem: I would use unchecking the "synchronize with composer.json" solution before changing the version in composer.json, unless you are *absolutely* sure that you will never have to support anything lower, and that none of your dependencies will ever have to use a lower versioned php installation. The composer.json option has more far reaching consequences (being checked each time you deploy to a different environment or install a new dependency) than changing your phpstorm configuration. ... Thanks a lot. This issue was driving me crazy every morning. ... I can confirm that unchecking ‘synchronize with composer.json’ on the PHP → Composer settings page worked perfectly.
Discussions

Remove php version from composer.json
Including this line in composer.json causes PHPStorm to lock certain settings like setting your PHP language level. More on github.com
🌐 github.com
7
February 13, 2019
Can not set Language level to PHP 7.4 in PhpStorm - Stack Overflow
P.S. Latest PhpStorm is 2021.1.1 and it supports PHP 8.0 ... Sign up to request clarification or add additional context in comments. ... How helpful is it to send someone off to page that has over 80 points on it? 2023-08-10T03:56:09.597Z+00:00 ... @TV-C-1-5 Which information are you missing? I believe this answer has enough information to answer that specific question (why 7.4 is not available in the Language Level ... More on stackoverflow.com
🌐 stackoverflow.com
phpstorm - PHP Language level missing latest (version 7.3 is the highest) - Stack Overflow
How do I get the latest version in the PHP Language Level field (to also get better code hints)? ... My version was this: 2018.2.3 - Build #PS-182.4323.68 built September 13, 2018. I hadn't tried updating PhpStorm. I could see that there is a newer version available (2018.2.7) - this was when I went to PhpStorm >> Check for Updates. But searching online I could see that there is a version 2020.3 available. After updating to version 2020.3 I can ... More on stackoverflow.com
🌐 stackoverflow.com
Unexpected/Incorrect PHP Version when running unit tests
Does your (phpunit) test explicitly refer to /usr/bin/php or something? Though as far as I know Apple stopped shipping php in recent macOS. Or do you have an M1, and have different ARM and Intel PHPs ? In PhpStorm you can point your tests to be run with a specific PHP, unrelated to the PATH set by zsh (they don’t run zsh to start PHP as far as I know) Cmd+, to open Prefences. Then PHP > CLI interpreter. Set your preferred PHP More on reddit.com
🌐 r/phpstorm
6
1
June 27, 2022
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360000129310-can-t-change-php-language-level-macOS-php71-in-opt-local-bin-not-usr-bin
can't change php language level macOS , php71 in /opt/local/bin not /usr/bin – IDEs Support (IntelliJ Platform) | JetBrains
April 4, 2018 - 1) Remove path to composer.json (Settings > Languages... > PHP > Composer), 2) change your PHP version (Settings > Languages... > PHP), 3) get back to composer.json path field and recover the path (press Redo like CTRL+Z), 4) Save.
🌐
JetBrains
jetbrains.com › help › phpstorm › supported-php-versions.html
Supported PHP versions | PhpStorm Documentation
January 8, 2026 - The supported PHP language levels are: ... To set the language level for your project, go to the Settings dialog (Ctrl+Alt+S) |PHP. There is no enforced correlation between the PHP version used in the project and the PHP language level configured ...
🌐
GitHub
github.com › drupal-composer › drupal-project › issues › 462
Remove php version from composer.json · Issue #462 · drupal-composer/drupal-project
February 13, 2019 - When I removed "php": ">=5.6", and ran composer update --lock, I could then set my language level in PHPStorm, pictured below.
Author   kevinquillen
🌐
JetBrains
jetbrains.com › help › phpstorm › php.html
PHP | PhpStorm Documentation
February 25, 2025 - If necessary, you can load a set of custom PHP stubs to be used by PhpStorm. Click next to the Default stubs path field and provide the stubs folder location in the dialog that opens.
🌐
Quora
quora.com › How-do-I-setup-PHP-7-in-PhpStorm
How to setup PHP 7 in PhpStorm - Quora
Answer: You have to change the path to PHP executable in Windows. System Properties > Advanced > Environment Variables - in the System Variables, select PATH and click Edit. Find the piece that refers to PHP 5, and change it to the path to the ...
Find elsewhere
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 207086975-Not-seeing-how-to-add-PHP-5-2-to-PHP-language-level
Not seeing how to add PHP 5.2 to PHP language level – IDEs Support (IntelliJ Platform) | JetBrains
January 21, 2016 - Since IDE does not support 5.2 .. I may only suggest to use 5.3 as language level. If you know what constructs need to be used there (or better say -- 5.3 features that should not be used here) then you should not have any issues writing your code -- based on the comments in aforementioned ticket (and related/duplicate tickets) it all works OK. ... I've run into another problem where PHPStorm is telling me a function exists which doesn't in PHP 5.2, yet I've got the PHP language level set to the lowest on the list, 5.3.
🌐
Codegive
codegive.com › blog › change_php_language_level_phpstorm.php
Change PHP Language Level in PhpStorm (2024): Unlock Modern Features & Crush Compatibility Errors!
A: No, PhpStorm's "PHP language level" is primarily a project-wide setting. While you can exclude files or directories from inspections, you cannot assign different PHP language levels to individual files or subfolders within the same project context in the same way you can for different language ...
🌐
Michael Smith
mikesmith.us › home › development › ide › phpstorm › how to change current project php version in phpstorm 2022.2.2
How To Change Current Project PHP Version in PhpStorm 2022.2.2 - Michael Smith
October 3, 2022 - The quickest and easiest method for changing the PHP level is simply to click the value in the status bar, then change it to the desired PHP level. I’m wanting to utilize PHP 8.1 in my project, so I’ll select that. This method is a bit longer than the previous one, but it also lets you ...
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360010578579-Unclear-on-the-difference-of-using-a-different-PHP-version-in-Language-Level-and-CLI-Interpreter
Unclear on the difference of using a different PHP version in Language Level and CLI Interpreter – IDEs Support (IntelliJ Platform) | JetBrains
March 31, 2021 - Now, I'd like PHPStorm to run suggestions and validations with PHP 5.6 so that my changes won't break stuff on our staging (QA) and production (Prod) servers (as in, inadvertently committing PHP 7+ changes that won't work on 5.6, because I don't have all of the breaking differences memorized all of the time)... So, in PHPStorm (macOS) > Preferences > Languages & Frameworks > PHP, I set "PHP language level" to 5.6, but then for "CLI Interpreter" I selected PHP 7.3 because that's what's installed and working...
🌐
Michael Smith
mikesmith.us › home › development › ide › phpstorm › how to set a default php version for all new projects in phpstorm 2022.2.2
How To Set A Default PHP Version For All New Projects In PhpStorm 2022.2.2 - Michael Smith
October 3, 2022 - The default, out-of-the-box ... in the Settings dialog box using the panel on the left. Expand the Languages & Frameworks menu then click on the heading PHP to bring up the options to change the PHP language level ......
🌐
Twitter
twitter.com › phpstorm › status › 1348936979879251969
PhpStorm, a JetBrains IDE
January 12, 2021 - JavaScript is not available · We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using twitter.com. You can see a list of supported browsers in our Help Center · Help Center · Terms of Service Privacy Policy ...
🌐
Reddit
reddit.com › r/phpstorm › unexpected/incorrect php version when running unit tests
r/phpstorm on Reddit: Unexpected/Incorrect PHP Version when running unit tests
June 27, 2022 -

Hi, probably me doing something stupid but after much google-fu and delving in storm's preferences I still cannot crack it.

I am running a mac and use brew to install / switch between multiple PHP versions. In terminal I am running the expected PHP version (8.1):

$ which php

/opt/homebrew/opt/php/bin/php

$ /opt/homebrew/opt/php/bin/php -v

/opt/homPHP 8.1.7 (cli) (built: Jun 9 2022 14:08:46) (NTS)

Copyright (c) The PHP Group

Zend Engine v4.1.7, Copyright (c) Zend Technologies

with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans

with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies

In Preferences -> PHP

I have PHP language level set to 8.1 and CLI Interpreter to my 8.1 executable location (which shows the correct version and xdebug version).

However, when I run my unit tests it is using my php 7.4 version.

🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 115000171850-Allow-mutliple-PHP-Language-Levels-Inspections-formating-in-one-Project
Allow mutliple PHP Language Levels / Inspections / formating in one Project – IDEs Support (IntelliJ Platform) | JetBrains
April 20, 2017 - Inspections can be changed (enabled/disabled/severity) on per scope level -- just create custom scope (in advance .. or right there in Inspections) and then choose how it should work there. https://www.jetbrains.com/help/phpstorm/2017.1/ins...