This is an IDE plugin that switches
the PHP Language Level automatically whenever an
editor window is focused, based on the version defined in the nearest composer.json
file (to the focused editor file).
That behaviour would be helpful if your project contains PHP code intended to run on different PHP versions (PhpStorm/IDEA) or if you are opening multiple projects as modules (IDEA).
https://github.com/user-attachments/assets/db36e668-5f40-4e8d-b69c-62a518c7223a
You cannot have multiple PHP files with different language level in the same directory, since there can only be
one composer.json
per directory.
composer.json
RequirementThe PHP version is only switched when a composer.json
file exists, containing a "php"
entry in the "require"
section. The "require-dev"
section is currently ignored.
The language level is still a global setting. If you have a PHP-7.4 file open next to a PHP-5.6 file, and you focus the PHP-5.6 one, errors/warnings will probably show up in the PHP-7.4 file since it tries to apply the PHP version there.