TL;DR: I see 'phpstan/extension-installer: Extensions installed' message but phpstan act like if it wasn't.
In an existing project, I want to add phpstan with symfony & doctrine extension.
When I type composer require --dev phpstan/phpstan phpstan/extension-installer phpstan/phpstan-doctrine phpstan/phpstan-symfony
I see the message "phpstan/extension-installer: Extensions installed" on the terminal, but when I try to run phpstan analyse I have the following error message:
vendor/bin/phpstan a -c phpstan.neon.dist
Invalid configuration:
Unexpected item 'parameters › symfony'.
This is solved by adding the 3 lines below in the phpstan.neon file, but according to the documentation that shouldn't be necessary, as I have the phpstan/extension-installer
.
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
Do you know how to solve it or what can I check to make it right ?
I finally found the solution: phpstan was installed globally, and when composer install
do the extension installation, it's done in the global phpstan version installed (and not in the local composer).
My solution was to move temporary the global installation directory, with mv ~/.composer ~/dot.composer
before composer install
, but the right solution might be to use --working-dir like this:
composer install --working-dir=.