PhpStorm is a smart IDE, but first you need to inform it which PHP environment we use, where PHP components are stored, and how they are configured. If you work with a local Web server, follow the Install an AMP package procedure to prepare your environment.
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.
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
You can use Alejandro Moreno's answer, but sometimes you might not be able to change PHP level from closed dropdown.
You can disable "Synchronize IDE settings with composer.json" checkbox from:
File -> Setting -> Languages & Frameworks -> PHP -> Composer
And after applying again open
File -> Settings -> Languages & Frameworks -> PHP
Here You can change PHP level from opened dropdown.
Open the Settings dialog box by choosing File | Settings, then click PHP under Languages & Frameworks. The PHP page opens.
Now you can do 2 things:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With