Add tests and doc for the feature and that#616
Merged
Conversation
6d755da to
0c8f684
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #616 +/- ##
=========================================
Coverage 98.33% 98.33%
Complexity 693 693
=========================================
Files 87 87
Lines 1981 1981
=========================================
Hits 1948 1948
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fain182
approved these changes
May 23, 2026
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.
andThat() has been part of the codebase since the AndThatShouldParser interface was introduced, but it had no dedicated tests and no documentation. This PR closes that gap.
Changes
Tests
tests/Unit/Rules/AndThatShouldTest.php — 7 unit tests covering the AND logic directly against ClassDescription objects:
class matching all conditions + should() fails → violation produced
class matching all conditions + should() passes → no violation
class matching only the first condition → should() skipped
class matching only the second condition → should() skipped
class matching neither condition → should() skipped
triple-chained andThat() — all match → violation
triple-chained andThat() — last condition not met → should() skipped
reusing a base rule with different andThat() branches produces independent rules
tests/Integration/AndThatFilterTest.php — 4 integration tests using vfsStream + TestRunner with real PHP files parsed on disk:
namespace AND naming convention filter
namespace AND attribute filter
three chained andThat() conditions
except() respected alongside andThat()
Documentation
README.md — new Combining multiple conditions with andThat() section added after the except() section, covering: basic usage, the skipping behaviour on partial matches, combining with except(), and the independent-branch pattern when reusing a partially-built rule.
Notes
No production code changes. No breaking changes.