psalm / psalm-plugin-symfony

Psalm Plugin for Symfony
MIT License
228 stars 53 forks source link

Allow setting Symfony's version explicitly #351

Closed HypeMC closed 5 months ago

HypeMC commented 5 months ago

I have Psalm installed globally and use it for different projects, each with different versions of Symfony. One problem I'm facing is that the plugin determines the version of Symfony by using the Kernel::MAJOR_VERSION constant, which means it will always use the globally installed version. As a result, it might not use the correct stubs for the specific version needed.

The same issue occurs when using the composer-bin-plugin. This PR allows configuring the version explicitly in the XML file:

<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin">
    <symfonyMajorVersion>6</symfonyMajorVersion>
</pluginClass>