Support Psalm 7 - #389
Merged
Merged
Support Psalm 7#389
Conversation
danog
marked this pull request as draft
October 2, 2026 16:46
This was referenced Oct 2, 2026
danog
marked this pull request as ready for review
October 5, 2026 08:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plugin requires
vimeo/psalm: ^6 || dev-master, and withminimum-stability: betacomposer resolvesdev-master, which is now Psalm 7. Psalm 7 changed the internals the Twig tainting uses, so the plugin no longer works with it:DataFlowNode's factories (its constructor is private), andDataFlowNode::getForMethodArgument()/getForMethodReturn()take a function's storage instead of labels and locations;HeaderBagHandlercalledCodebase::addTaintSource()with the Psalm 6 arguments (taints before the location, taints as a list of names), aTypeErroron Psalm 7 as soon as the taint analysis met$request->headers->get('user-agent'). It also dropped the typeaddTaintSource()returns, which is the only way the source reaches the value (on Psalm 6 too), so theuser-agentsource never tainted anything.This drops Psalm 6 support, requires
vimeo/psalm: ^7 || dev-master, and requirespsalm/psalm-plugin-api: ^0.3, the plugin API this is written for:DataFlowNode::getForPropertyFetch(), the factory of a node with only an id), the nodes inside a template are assignment nodes at their location in the template, and the argument ofrender()is resolved withDataFlowNode::getForMethodArgumentById().HeaderBagHandler:addTaintSource()is called with the Psalm 7 signature (TaintKind::ALL_INPUT), and its result is used.MissingPureAnnotation,MissingImmutableAnnotation), added withpsalm --alter. The@psalm-suppress UnusedClassofTemplateFileAnalyzer, which Psalm 7 reports as unused, is removed.psalm --find-dead-code --find-unused-psalm-suppressreports no errors.info, as it already does forUnusedVariable; the Twig tainting feature, which has its own configuration, annotates its stub function instead. The unit test building aStatementsAnalyzerpasses the new$root_scopeargument and initialises the project files that reporting an issue now reads.phpunit(45 tests) andcodecept run -g symfony-common(96 tests) pass with Psalmdev-master. Dropping Psalm 6 is a breaking change, so this probably calls for a new major version.