This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 33namespace ProgrammatorDev \YetAnotherPhpValidator \Rule ;
44
55use ProgrammatorDev \YetAnotherPhpValidator \Exception \RangeException ;
6- use ProgrammatorDev \YetAnotherPhpValidator \Exception \ValidationException ;
6+ use ProgrammatorDev \YetAnotherPhpValidator \Exception \UnexpectedValueException ;
77use ProgrammatorDev \YetAnotherPhpValidator \Rule \Util \AssertIsComparableTrait ;
88use ProgrammatorDev \YetAnotherPhpValidator \Validator ;
99use Symfony \Component \OptionsResolver \OptionsResolver ;
@@ -35,13 +35,13 @@ public function assert(mixed $value, string $name): void
3535 {
3636 $ this ->assertIsComparable ($ this ->minConstraint , $ this ->maxConstraint );
3737
38- try {
39- Validator
40- ::greaterThanOrEqual ($ this ->minConstraint )
41- ->lessThanOrEqual ($ this ->maxConstraint )
42- ->assert ($ value , $ name );
38+ if (!Validator::greaterThan ($ this ->minConstraint )->validate ($ this ->maxConstraint )) {
39+ throw new UnexpectedValueException (
40+ 'Max constraint value must be greater than min constraint value. '
41+ );
4342 }
44- catch (ValidationException ) {
43+
44+ if (!Validator::greaterThanOrEqual ($ this ->minConstraint )->lessThanOrEqual ($ this ->maxConstraint )->validate ($ value )) {
4545 throw new RangeException (
4646 message: $ this ->options ['message ' ],
4747 parameters: [
You can’t perform that action at this time.
0 commit comments