diff --git a/README.md b/README.md index ccac626..10165eb 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,18 @@ If you're getting the following error ``` +#### Symfony version + +By default, the plugin uses the `Kernel::MAJOR_VERSION` constant to determine your version of Symfony. However, this +might not be accurate if you have Psalm installed globally. You can set the version explicitly using +the `symfonyMajorVersion` configuration option: + +```xml + + 6 + +``` + ### Twig tainting (experimental) When it comes to taint analysis for Twig templates, there are currently two approaches: diff --git a/src/Plugin.php b/src/Plugin.php index ce9c543..4cd10b3 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -89,7 +89,7 @@ public function __invoke(RegistrationInterface $registration, ?\SimpleXMLElement $registration->registerHooksFromClass(ContainerHandler::class); $this->addStubs($registration, __DIR__.'/Stubs/common'); - $this->addStubs($registration, __DIR__.'/Stubs/'.Kernel::MAJOR_VERSION); + $this->addStubs($registration, __DIR__.'/Stubs/'.($config->symfonyMajorVersion ?? Kernel::MAJOR_VERSION)); $this->addStubs($registration, __DIR__.'/Stubs/php'); if (isset($config->twigCachePath)) {