Synchronization with composer.json behaves weird

Using PhpStorm 2023.3.5 with a fresh Symfony 6.4 / PHP 8.2 project, the IDE detected correctly my current PHP version from my local environment, but the language level is set to PHP 8.1 because it is read from the composer.json:

 

My current composer.json:

 

Therefore, I manually set the language level to match my PHP version from my local environment (i.e. PHP 8.2):

But, every time I close and open the IDE, the language level is reverted to PHP 8.1, due to is read from the compose.json, but it's supposed that in the composer.json the PHP version is set to be “greater or equal to 8.1 ("php": "≥8.1"), should be enough to set the language level in an automatic way, especially when I explicitly set the version the first time I load and configure the project?

And, because I like to rename my projects (not the folder) If I disable the synchronization, the language level works fine (because now it is not read from the composer.json!), but every time I close and open the IDE, Directories settings, specifically the namespaces for folders "src/"  and “tests/” are lost and I have to set again:

Therefore, this is what I should have:

 

But, this is what I actually get:

 

Can anyone explain me what I'm doing wrong? Is this an error, or I'm doing things the wrong way?

 

0
1 comment

≥8.1 means that you shouldn't set your language level to 8.2 because your code needs to be compatible with 8.1. If you want to allow 8.2 syntax and features you need to increase the version in Composer require key.

1

Please sign in to leave a comment.