-
Notifications
You must be signed in to change notification settings - Fork 775
Invert the behaviour of NotUndef
#1574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1e89477 to
75a8ef8
Compare
There was a problem hiding this 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 refactors the NotUndef rule by inverting its behavior and renaming it to Undef. The rule now validates if input IS undefined (null or empty string) rather than validating if input is NOT undefined. The change enables users to achieve the old NotUndef behavior by using the not prefix with the new Undef rule (e.g., not(v::undef())).
- Renamed
NotUndefclass toUndefthroughout the codebase - Swapped template messages to reflect inverted behavior
- Updated all tests, documentation, and mixin interfaces to use the new naming
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
library/Rules/Undef.php |
Renamed class from NotUndef to Undef and swapped template messages for inverted behavior |
library/Transformers/Prefix.php |
Updated untransformed rule name from notUndef to undef |
library/Mixins/*.php |
Updated all mixin interface method signatures from notUndef/propertyNotUndef/keyNotUndef to undef/propertyUndef/keyUndef |
tests/unit/Rules/UndefTest.php |
Renamed test class and updated test data providers to reflect new behavior |
tests/unit/Helpers/CanValidateUndefinedTest.php |
Updated data provider references for the undefined validation helper |
tests/unit/Transformers/PrefixTest.php |
Updated test case from notUndef to undef in untransformed rule names |
tests/library/TestCase.php |
Renamed data provider method for undefined values |
tests/library/Stubs/WithAttributes.php |
Updated stub class to use new Undef rule name |
tests/feature/Rules/UndefTest.php |
Updated feature tests to use new undef() method name |
tests/feature/Rules/UndefOrTest.php |
Updated message key references from notUndefOr* to undefOr* |
docs/rules/Undef.md |
Created new documentation for Undef rule with inverted behavior description |
docs/rules/NotUndef.md |
Removed old NotUndef documentation |
docs/rules/*.md |
Updated cross-references from NotUndef to Undef across multiple rule documentation files |
docs/09-list-of-rules-by-category.md |
Updated rule categorization to replace NotUndef with Undef |
docs/rules/Attributes.md |
Updated example code to use new Undef rule name |
bin/create-mixin |
Updated mixin generation script to use Undef instead of NotUndef |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
75a8ef8 to
8abfa31
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1574 +/- ##
=========================================
Coverage 97.49% 97.49%
Complexity 988 988
=========================================
Files 205 205
Lines 2237 2237
=========================================
Hits 2181 2181
Misses 56 56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 25 out of 26 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Since we have the ability to use `not` as a prefix, having rules that start with not becomes a bit inflexible, verbose, and harder to understand. This commit will refactor the `NotUndef` rule by inverting its behaviour and renaming it to `Undef`.
8abfa31 to
7046560
Compare
Since we have the ability to use
notas a prefix, having rules that start with not becomes a bit inflexible, verbose, and harder to understand.This commit will refactor the
NotUndefrule by inverting its behaviour and renaming it toUndef. Although this is a breaking change, users will not feel it because "NotUndef" will still be available by using thenotprefix followed by theUndefrule.