[Chore]: Add NoAssertSeeRule to flag assertSee assertions in tests - #149
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new custom PHPStan rule to discourage brittle “assertSee”-style assertions in tests by flagging calls to the assertSee* / assertDontSee* family on known testing receivers, along with focused PHPStan-rule tests and fixtures to validate correct detection, exclusions, and inline-ignoring behavior.
Changes:
- Introduces
CanyonGBS\Common\Rules\NoAssertSee\NoAssertSeeRuleand registers it inphpstan-extension.neon. - Adds a dedicated PHPStan config plus Pest-based rule tests that execute PHPStan against fixtures.
- Adds fixtures that exercise banned assertions, allowed lookalikes, and identifier-based inline ignores.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PHPStan/NoAssertSeeTest.php | Adds Pest coverage that runs PHPStan against fixtures and validates rule triggering/ignoring. |
| tests/PHPStan/Fixtures/AssertSeeFixture.php | Fixture containing a representative set of banned assertSee*/assertDontSee* calls. |
| tests/PHPStan/Fixtures/AssertSeeAllowedFixture.php | Fixture ensuring same-named methods on unrelated classes (and other assertions) are not flagged. |
| tests/PHPStan/Fixtures/AssertSeeIgnoredFixture.php | Fixture ensuring identifier-based inline ignore suppresses the rule as intended. |
| tests/PHPStan/Configs/no-assert-see.neon | Minimal PHPStan config to run the rule against fixtures in isolation. |
| src/Rules/NoAssertSee/NoAssertSeeRule.php | Implements the new PHPStan rule and its receiver/type filtering + identifier. |
| phpstan-extension.neon | Registers the new rule in the package’s PHPStan extension services. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
danharrin
approved these changes
Aug 24, 2026
danharrin
force-pushed
the
chore/ban-assert-see
branch
from
August 24, 2026 14:17
5024a5c to
7fa5806
Compare
Signed-off-by: Kevin Ullyott <kevin.ullyott@canyongbs.com>
danharrin
force-pushed
the
chore/ban-assert-see
branch
from
August 24, 2026 14:18
7fa5806 to
a07344f
Compare
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.
Ticket(s) or GitHub Issue
Technical Description
Adds a custom PHPStan rule banning the usage of testing
assertSeetype methods.Any deployment steps required?
No
Are any Feature Flags and/or Data Migrations that can eventually be removed Added?
No
Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.