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
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.
macos - PhpStorm + XAMPP not showing latest PHP version in command line - Stack Overflow
Wrong PHP version when executing composer scripts
ide - PhpStorm ignores PHP version setting in project - Stack Overflow
Using PHP as CLI Interpreter in PhpStorm
Hi, I need help when running my composer scripts. I'm using Laravel Pint as my formatter
and even though the machine is already using the correct php version, the output displays
a different version.
I have already configured phpstorm's cli interpreters, quality tools (laravel pint) and composer's PHP interpreter to the correct version. Anyone here also had the same issue? Thank you.
Version: 2023.3.5
Build: 233.14808.18
11 March 2024
Edit: I found the issue, it does not detect what I set in phpbrew. I had to install php using apt, is there any way I can still use phpbrew?
