Repository navigation
Support DBAL 4, ORM 3, Collections 2 and Persistence 4, and taint the rows the database fetches - #166
Merged
Merged
Conversation
… rows the database fetches The stubs of the APIs a version removed load only for the versions that have them (DBAL < 4: Connection::exec(), query() and executeUpdate(), ExpressionBuilder::andX() and orX(), ParameterType, a class until it became an enum; ORM < 3: ClassMetadataInfo), and DBAL 4 gets a Connection stub of its own. The value template of the Collection stub is T, as in doctrine/collections, which declares map() with a template of its own. executeQuery() and the fetch*() and iterate*() methods of Connection take SQL, and what they, Result and the array and scalar results of an ORM query return is input: other requests may have written it.
danog
added a commit
to danog/psalm
that referenced
this pull request
Nov 18, 2026
Psalm requires the plugin, which describes DBAL by version, and enables it for the projects requiring Doctrine (psalm/psalm-plugin-doctrine#166).
InstalledVersions::satisfies() is false for any constraint with composer/semver 1.x, which the lowest dependencies install, so neither DBAL Connection stub was loaded. The ORM query of the taint test is typed like the connection, which the oldest Psalm 7 releases want pure.
DBAL 2.13 declares the fetch methods on the Driver\Result, Abstraction\Result and Result interfaces, which executeQuery() returns; DBAL 3 makes Result a class.
danog
added a commit
to danog/psalm
that referenced
this pull request
Nov 18, 2026
Psalm requires the plugin, which describes DBAL by version, and enables it for the projects requiring Doctrine (psalm/psalm-plugin-doctrine#166).
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 stubs describe DBAL 2/3 and ORM 2 only, so on the current majors they declare APIs that no longer exist, and the rows the database fetches aren't taint sources.
Before (DBAL 4, ORM 3, Collections 2)
After
The stubs of removed APIs load only for the versions that have them (
stubs/DBAL/before-4,stubs/ORM/before-3, picked withComposer\InstalledVersions), DBAL 4 gets its ownConnectionstub, and CI's "high" deps now install DBAL 4, ORM 3, Collections 2 and Persistence 4 while "low" keeps ORM 2.6 and DBAL 2.13. The acceptance suite passes on DBAL 4/ORM 3 and on DBAL 3/ORM 2.Psalm is about to require this plugin and enable it for every project requiring Doctrine (vimeo/psalm, follow-up PR), which is why the current majors must work out of the box.