-1

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 ?

2 Answers 2

0

You should see this message in the output after running composer command like install, update or require:

phpstan/extension-installer: Extensions installed

If you don't see that there then the Composer plugin is not really running for some reason. Maybe you've disabled it in composer.json.

Sign up to request clarification or add additional context in comments.

1 Comment

This message is present in the install output (it written in the paragraph, I will edit the question to make it more visible). Also it's ok from a gitlab-ci stage when I run composer install --no-progress && vendor/bin/phpstan a -c phpstan.neon.dist
0

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=.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.