Skip to content

Fix issue in ForbidPestPhpOnly flagging non-pest only calls#88

Merged
Orrison merged 3 commits intomainfrom
only-bugfix
Oct 16, 2025
Merged

Fix issue in ForbidPestPhpOnly flagging non-pest only calls#88
Orrison merged 3 commits intomainfrom
only-bugfix

Conversation

@Orrison
Copy link
Owner

@Orrison Orrison commented Oct 16, 2025

Ensures that only Pest PHP only() calls are flagged.

…d tests for non-Pest usage

Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com>
@Orrison Orrison requested a review from Copilot October 16, 2025 05:01
@Orrison Orrison added the bug Something isn't working label Oct 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@Orrison Orrison requested a review from Copilot October 16, 2025 05:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@Orrison Orrison merged commit e097009 into main Oct 16, 2025
5 checks passed
@Orrison Orrison deleted the only-bugfix branch October 16, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants