This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ require_once 'vendor/autoload.php';
2525Simple usage looks like:
2626
2727``` php
28+ use ProgrammatorDev\YetAnotherPhpValidator\Validator;
2829
30+ $ageValidator = Validator::notBlank()->greaterThanOrEqual(18);
31+
32+ $ageValidator->validate(16); // returns false
33+ $ageValidator->assert(16, 'Age'); // throws exception: The "Age" value should be greater than or equal to "18", "16" given.
2934```
3035
3136## Documentation
Original file line number Diff line number Diff line change @@ -44,8 +44,7 @@ public function assert(mixed $value, string $name): void
4444 }
4545
4646 if (
47- !Validator
48- ::greaterThan ($ minConstraint )
47+ !Validator::greaterThan ($ minConstraint )
4948 ->validate ($ maxConstraint )
5049 ) {
5150 throw new UnexpectedValueException (
@@ -54,8 +53,7 @@ public function assert(mixed $value, string $name): void
5453 }
5554
5655 if (
57- !Validator
58- ::greaterThanOrEqual ($ minConstraint )
56+ !Validator::greaterThanOrEqual ($ minConstraint )
5957 ->lessThanOrEqual ($ maxConstraint )
6058 ->validate ($ value )
6159 ) {
You can’t perform that action at this time.
0 commit comments