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 OverflowSo, 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.
In case your field is disabled.
Probably your settings "Synchronize IDE settings with composer.json" is enabled
You may change your PHP version in composer.json file
"require": {
"php": ">=7.1.0",
}
OR disable your settings in this path
File -> Settings -> Languages & Frameworks > PHP > Composer
*If you change your composer.json file - As Félix Gagnon-Grenier commented, Keep in mind it has effects on the way packages will be required later
Videos
Hi everyone,
Recently I noticed that the PHP version selector that appeared in the lower right corner is not there anymore. I remember in previous versions that I had a selector where I could change the PHP version used in the project, but it seems like it's not there anymore
Any ideas on how to bring it back?
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.