Repository navigation
Add tips to the rule errors - #363
Merged
Merged
Conversation
Each of the five rules now emits a RuleErrorBuilder tip explaining why the rule fired and how to fix the code: inject the collection factory, use the entity's repository (with a devdocs link), pass a Collection subclass to getCollectionMock(), inject the resource model, or set the block template via layout XML or constructor data. The rule tests assert the tips, so a changed or dropped tip fails the suite.
Member
|
@michielgerritsen you should have taken over a lot sooner :) Great work! Happy to see the extension is still kicking (more than 5K installs in the last 24 hours says packagist). |
michielgerritsen
added a commit
that referenced
this pull request
Nov 21, 2026
Bumping the floor to ^2.2 would hold the next release back from every consumer still resolving PHPStan 2.0/2.1. The only reason for the bump was the test suite itself: it mocked MutatingScope, which those releases declare final. The test mocks plain Scope again and the Scope&DependencyTracker analyze error that PHPStan >= 2.3 reports for that mock is ignored in phpstan.neon, with reportUnmatched off because older releases never emit it. The compat floor leg moves from 2.2.0 to 2.0.0, so the full advertised range is executed: verified locally on 2.0.0 (including the rule tip assertions from #363) and 2.3.7, 114 tests green on both, analyze clean on 2.2.14 and 2.3.7.
Contributor
Author
|
Haha thanks @shochdoerfer! |
Contributor
Author
|
Closing and reopening to rebuild the merge ref against master, which now includes #364, so this PR runs the new compat and real-codebase checks. |
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.
Fixes #167. Each of the five rules now emits a
RuleErrorBuilder::tip()explaining why the rule fired and how to fix the code, with links to the service-contracts devdocs and the extdn sniff doc where one exists. The five rule tests assert the tip texts, so a changed or dropped tip fails the suite. Tips never enter baselines,ignoreErrorsmatching, or checkstyle output, so existing consumer configurations keep working after an upgrade. Verified on PHPStan 2.2.14 and 2.3.7: full suite green,composer analyzeandcs-checkclean.