Fix duplicate registration of RepositoryMethodCallRule#764
Merged
ondrejmirtes merged 2 commits intoJun 2, 2026
Merged
Conversation
RepositoryMethodCallRule was registered twice: once in the `rules:` section (autowired with checkOrderByFields defaulting to false) and again as a tagged service in `services:` wiring checkOrderByFields to the bleedingEdge feature toggle. Both registrations carry the phpstan.rules.rule tag, so the rule executed twice and reported every magic findBy*/findOneBy* violation as a duplicate. Keep only the `services:` registration, which is the intended one as it wires the checkOrderByFields toggle introduced together with the duplicate. Co-Authored-By: Claude Code
The duplicate RepositoryMethodCallRule registration made the findOneBy()/findBy() field errors appear twice; the fixture had been updated to expect the doubled output. With the duplicate registration removed, each error is reported once again. Co-Authored-By: Claude Code
Member
|
Thank you! |
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.
Problem
RepositoryMethodCallRuleis currently registered twice inrules.neon:rules:section (autowired, socheckOrderByFieldsdefaults tofalse):services:, wiringcheckOrderByFieldsto the bleeding-edge toggle:Both registrations carry the
phpstan.rules.ruletag, so PHPStan instantiates and runs the rule twice. As a result every magicfindBy*/findOneBy*violation is reported as a duplicate error.The
services:entry was added in 5485522 ("Check field names of orderBy parameter in findBy and findOneBy"), while therules:entry already existed — making therules:line a stray duplicate. The same commit also updated theentityRepositoryDynamicReturn-0.jsonintegration fixture to expect the doubled output, which hid the regression.Fix
rules:entry and keep only theservices:registration, which is the intended one since it wires thecheckOrderByFieldstoggle.entityRepositoryDynamicReturn-0.jsonfixture so eachfindOneBy()/findBy()error is expected once.Co-Authored-By: Claude Code