Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1606 +/- ##
============================================
+ Coverage 97.47% 97.51% +0.03%
- Complexity 993 1006 +13
============================================
Files 211 212 +1
Lines 2298 2334 +36
============================================
+ Hits 2240 2276 +36
Misses 58 58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c55b39f to
0ccecf3
Compare
|
I wanted to make the |
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new ContainsCount validator that validates whether a value appears in a string or array exactly a specified number of times. The validator supports both case-insensitive (default) and identical comparisons. Additionally, the Domain validator has been updated to use ContainsCount instead of an unserializable callback, making the Domain validator serializable.
Changes:
- Added new
ContainsCountvalidator class with support for counting occurrences in strings and arrays - Updated
Domainvalidator to useContainsCountinstead of a callback, making it serializable - Added comprehensive unit and feature tests for the new validator
- Added documentation and updated cross-references
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| library/Validators/ContainsCount.php | New validator class for checking exact occurrence count of a value |
| library/Validators/Domain.php | Removed unserializable callback in favor of ContainsCount |
| library/Mixins/Chain.php | Added containsCount method signature to Chain mixin |
| library/Mixins/Builder.php | Added containsCount static method signature to Builder mixin |
| tests/unit/Validators/ContainsCountTest.php | Unit tests for valid and invalid inputs |
| tests/feature/Validators/ContainsCountTest.php | Feature tests for error messages |
| tests/benchmark/ValidatorBench.php | Added benchmark cases for ContainsCount and Domain |
| docs/validators/ContainsCount.md | Documentation for the new validator |
| docs/validators/index.md | Updated index to include ContainsCount |
| docs/validators/Contains.md | Added cross-reference to ContainsCount |
| docs/validators/ContainsAny.md | Added cross-reference to ContainsCount |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0ccecf3 to
bde6f89
Compare
bde6f89 to
fa1223f
Compare
This validator is similar to Contains, but also checks how many times the needle appears. Additionally, the Domain validator was changed to use it instead of relying on an unserializable callback, thus, making it serializable.
fa1223f to
f5e22f1
Compare
This validator is similar to Contains, but also checks how many times the needle appears.
Additionally, the Domain validator was changed to use it instead of relying on an unserializable callback, thus, making it serializable.