-
Notifications
You must be signed in to change notification settings - Fork 775
Create All rule and all prefix
#1578
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1578 +/- ##
============================================
+ Coverage 97.42% 97.44% +0.01%
- Complexity 987 991 +4
============================================
Files 212 213 +1
Lines 2255 2268 +13
============================================
+ Hits 2197 2210 +13
Misses 58 58 ☔ 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
This PR introduces a new All rule that validates all items in an array or iterable against a given rule, similar to Each but with simplified single-message presentation. It also adds an all prefix to enable composition patterns like v::allStringType().
- Implements the
Allrule class extendingFilteredNonEmptyArraywith simplified messaging - Adds
allprefix support in thePrefixtransformer for easier rule composition - Updates all mixin interfaces to support the new rule and prefix patterns
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
library/Rules/All.php |
Core implementation of the All rule with template definition and validation logic |
library/Transformers/Prefix.php |
Adds 'all' to RULES_TO_SKIP and implements prefix transformation for 'all*' methods |
library/Mixins/AllChain.php |
New mixin interface defining chainable methods for all prefixed rules |
library/Mixins/AllBuilder.php |
New mixin interface defining static builder methods for all prefixed rules |
library/Mixins/Chain.php |
Extends Chain interface with AllChain and adds all() method |
library/Mixins/Builder.php |
Extends Builder interface with AllBuilder and adds static all() method |
library/Mixins/KeyChain.php |
Adds keyAll() method signature for composing All rule with Key |
library/Mixins/KeyBuilder.php |
Adds static keyAll() method signature |
library/Mixins/NotChain.php |
Adds notAll() method signature for negating All rule |
library/Mixins/NotBuilder.php |
Adds static notAll() method signature |
library/Mixins/NullOrChain.php |
Adds nullOrAll() method signature for optional validation |
library/Mixins/NullOrBuilder.php |
Adds static nullOrAll() method signature |
library/Mixins/PropertyChain.php |
Adds propertyAll() method signature for object property validation |
library/Mixins/PropertyBuilder.php |
Adds static propertyAll() method signature |
library/Mixins/UndefOrChain.php |
Adds undefOrAll() method signature for undefined-or validation |
library/Mixins/UndefOrBuilder.php |
Adds static undefOrAll() method signature |
tests/unit/Rules/AllTest.php |
Unit tests covering valid and invalid inputs for the All rule |
tests/feature/Rules/AllTest.php |
Feature tests verifying default and inverted template messages |
tests/feature/Transformers/PrefixTest.php |
Tests the all prefix transformation with message validation |
docs/rules/All.md |
Documentation for the All rule with usage examples and categorization |
docs/rules/Each.md |
Adds cross-reference to All rule and fixes trailing whitespace |
docs/rules/Length.md |
Adds cross-references to All and Each rules |
docs/rules/Max.md |
Adds cross-reference to All rule |
docs/rules/Min.md |
Adds cross-reference to All rule |
docs/09-list-of-rules-by-category.md |
Adds All rule to Comparisons, Transformations, and Alphabetically sections |
bin/create-mixin |
Updates mixin generator to include AllBuilder and AllChain with proper configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
af52ddc to
8836a5d
Compare
8836a5d to
e8b90a3
Compare
e8b90a3 to
c220bb5
Compare
c220bb5 to
09fd2af
Compare
09fd2af to
f2299e6
Compare
This rule behaves similarly to ``Each, but the difference is that it presents the messages in a simpler manner. This allows users to have a simpler message when validating all items in an array or iterable value. I’m also introducing the `all` prefix, making it easier for users to apply the `All` rule in combination with other rules.
f2299e6 to
0a45eaf
Compare
This rule behaves similarly to ``Each, but the difference is that it presents the messages in a simpler manner. This allows users to have a simpler message when validating all items in an array or iterable value.
I’m also introducing the
allprefix, making it easier for users to apply theAllrule in combination with other rules.