Skip to content

Commit

Permalink
Allow setting Symfony's version explicitly (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
HypeMC authored Jun 20, 2024
1 parent d107a4c commit 465f8e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ If you're getting the following error
</issueHandlers>
```

#### 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
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin">
<symfonyMajorVersion>6</symfonyMajorVersion>
</pluginClass>
```

### Twig tainting (experimental)

When it comes to taint analysis for Twig templates, there are currently two approaches:
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 465f8e2

Please sign in to comment.