Support ExpressionWithReturnType from ORM 3.7 - #790
Draft
janedbal wants to merge 4 commits into
Draft
Conversation
ORM 3.7 deprecates TypedExpression in favor of ExpressionWithReturnType (doctrine/orm#12543). Custom DQL functions that implement only the new interface lost their declared type and fell back to the driver-dependent default. The walker now checks the new interface first and keeps the TypedExpression fallback for older ORM versions. Co-Authored-By: Claude Code
ORM 3.7 marks TypedExpression as deprecated. The extension must keep the fallback for ORM < 3.7, and the test fixtures must keep covering it. Co-Authored-By: Claude Code
ORM 3.7 adds a constructor with an int $position parameter to Doctrine\ORM\Mapping\Id. Without @NamedArgumentConstructor the annotation reader passes the values array to that parameter and fails with a TypeError. Co-Authored-By: Claude Code
ORM 3.7 adds a class docblock to JoinColumns and a SortDirection import to OrderBy. The old patch context no longer matches, so composer-patches skipped both patches and the annotation reader rejected the classes. Co-Authored-By: Claude Code
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.
ORM 3.7 deprecates
TypedExpressionin favor ofExpressionWithReturnType(doctrine/orm#12543). A custom DQL function that implements only the new interface lost its declared type. The walker treated it as an untyped expression and inferred the driver-dependent default.Changes:
QueryResultTypeWalkerreads the type name fromExpressionWithReturnType::getReturnTypeName()first. It falls back toTypedExpression::getReturnType()for ORM < 3.7.StringType/EnumTypeno-op check now works on the resolved type name, so both paths share it.ExpressionWithReturnType. The matrix test registers and runs them only when the interface exists.compatibility/orm-3-baseline.phpexcludes those fixtures from analysis on ORM < 3.7. PHPStan cannot ignore "implements unknown interface", so the exclusion has to be dynamic.phpstan.neonignores theTypedExpressiondeprecation reports that ORM 3.7 produces. The fallback and its fixtures must stay for ORM < 3.7.Id,JoinColumns, andOrderBypatches incompatibility/patches/are updated for ORM 3.7.0 (released 2026-09-07).Idgained a constructor and needs@NamedArgumentConstructor.JoinColumnsandOrderBychanged their headers, so the old patch context did not apply. This is unrelated to the walker change but blocks the ORM 3 CI jobs on2.0.xas well.Verified locally with ORM 2.20 / DBAL 3 and with ORM 3.7.0 / DBAL 4.4.4: PHPStan level 8 is clean under both, the full unit suite passes under both, and the sqlite platform cases for both interfaces pass.
Co-Authored-By: Claude Code