Skip to content

Conversation

@henriquemoody
Copy link
Member

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. Although this is a breaking change, users will not feel it because "NotUndef" will still be available by using the not prefix followed by the Undef rule.

Copy link

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 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 NotUndef class to Undef throughout 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.

@codecov
Copy link

codecov bot commented Dec 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.49%. Comparing base (338c186) to head (7046560).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

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 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`.
@henriquemoody henriquemoody merged commit 7046560 into Respect:main Dec 27, 2025
5 checks passed
@henriquemoody henriquemoody deleted the core/undef branch December 27, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant