Unexpected token '(' in named argument inspection despite composer.json PHP 8.1 requirement
29K reputation · 02 May 2021, 04:24 UTC
Goal: Configure PHPStorm to automatically use the PHP version declared in composer.json for its language‑level inspections so that valid modern syntax is not flagged as errors.
Constraints: The IDE does not read the require → php field from composer.json; the language level must be set manually via Settings | Languages & Frameworks | PHP. The quick‑fix “Set PHP language level to X” appears only after a file containing the offending construct is opened, and the chosen level is stored per‑project in the .idea workspace, which is not typically version‑controlled, requiring each developer to apply it individually.
- Can PHPStorm be made to detect the
composer.jsonPHP requirement and set the language level automatically on project load? - Is there a way to trigger the “Set PHP language level to X” quick‑fix without first opening a file that contains the newer syntax?
- Can the language‑level setting be persisted in a version‑controlled file (e.g.,
.idea/misc.xmlor a dedicated XML) so that all team members receive the same inspection baseline?