Fix issue in ForbidPestPhpOnly flagging non-pest only calls#88
Merged
Conversation
…d tests for non-Pest usage Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR tightens the ForbidPestPhpOnly rule to only flag Pest’s only() calls that originate from Pest’s test()/it() helpers, avoiding false positives for unrelated methods named only.
- Restricts detection to only() chains rooted at Pest’s test()/it()
- Adds a non-Pest fixture to assert valid only() usages are ignored and updates test expectations
- Updates documentation to clarify scope
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Rules/ForbidPestPhpOnly/ForbidPestPhpOnlyRuleTest.php | Adjusts expectations and adds a fixture to ensure non-Pest only() calls don’t trigger errors |
| tests/Rules/ForbidPestPhpOnly/Fixture/NonPestOnlyUsageFixture.php | New fixture demonstrating allowed non-Pest only() usages |
| tests/Rules/ForbidPestPhpOnly/Fixture/InvalidPestFixture.php | Removes a case (uses()->group()->only()) no longer flagged by the updated rule |
| src/Rules/ForbidPestPhpOnly/ForbidPestPhpOnlyRule.php | Implements origin tracing and entry point filtering for only() calls |
| docs/ForbidPestPhpOnly.md | Documents that only only() calls from test()/it() are reported |
… after verifying test file Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
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.
Ensures that only Pest PHP
only()calls are flagged.