77
88interface ChainedValidatorInterface
99{
10- /**
11- * @throws ValidationException
12- */
13- public function assert (mixed $ value , string $ name ): void ;
14-
15- public function validate (mixed $ value ): bool ;
16-
17- // --- Rules ---
18-
19- public function all (
20- array $ constraints ,
21- string $ message = 'At "{{ key }}": {{ message }} '
22- ): ChainedValidatorInterface ;
23-
2410 public function choice (
2511 array $ constraints ,
2612 bool $ multiple = false ,
@@ -30,54 +16,66 @@ public function choice(
3016 string $ multipleMessage = 'The "{{ name }}" value has one or more invalid choices, "{{ value }}" given. Accepted values are: "{{ constraints }}". ' ,
3117 string $ minMessage = 'The "{{ name }}" value must have at least {{ minConstraint }} choices, {{ numValues }} choices given. ' ,
3218 string $ maxMessage = 'The "{{ name }}" value must have at most {{ maxConstraint }} choices, {{ numValues }} choices given. '
33- ): ChainedValidatorInterface ;
19+ ): ChainedValidatorInterface & Validator ;
3420
3521 public function country (
3622 string $ code = 'alpha-2 ' ,
3723 string $ message = 'The "{{ name }}" value is not a valid "{{ code }}" country code, "{{ value }}" given. '
38- ): ChainedValidatorInterface ;
24+ ): ChainedValidatorInterface &Validator ;
25+
26+ public function eachKey (
27+ Validator $ validator ,
28+ string $ message = 'Invalid key: {{ message }} '
29+ ): ChainedValidatorInterface &Validator ;
30+
31+ public function eachValue (
32+ Validator $ validator ,
33+ string $ message = 'At key "{{ key }}": {{ message }} '
34+ ): ChainedValidatorInterface &Validator ;
3935
4036 public function greaterThan (
4137 mixed $ constraint ,
4238 string $ message = 'The "{{ name }}" value should be greater than "{{ constraint }}", "{{ value }}" given. '
43- ): ChainedValidatorInterface ;
39+ ): ChainedValidatorInterface & Validator ;
4440
4541 public function greaterThanOrEqual (
4642 mixed $ constraint ,
4743 string $ message = 'The "{{ name }}" value should be greater than or equal to "{{ constraint }}", "{{ value }}" given. '
48- ): ChainedValidatorInterface ;
44+ ): ChainedValidatorInterface & Validator ;
4945
5046 public function lessThan (
5147 mixed $ constraint ,
5248 string $ message = 'The "{{ name }}" value should be less than "{{ constraint }}", "{{ value }}" given. '
53- ): ChainedValidatorInterface ;
49+ ): ChainedValidatorInterface & Validator ;
5450
5551 public function lessThanOrEqual (
5652 mixed $ constraint ,
5753 string $ message = 'The "{{ name }}" value should be less than or equal to "{{ constraint }}", "{{ value }}" given. '
58- ): ChainedValidatorInterface ;
54+ ): ChainedValidatorInterface & Validator ;
5955
6056 public function notBlank (
6157 ?callable $ normalizer = null ,
6258 string $ message = 'The "{{ name }}" value should not be blank, "{{ value }}" given. '
63- ): ChainedValidatorInterface ;
59+ ): ChainedValidatorInterface & Validator ;
6460
6561 public function range (
6662 mixed $ minConstraint ,
6763 mixed $ maxConstraint ,
6864 string $ message = 'The "{{ name }}" value should be between "{{ minConstraint }}" and "{{ maxConstraint }}", "{{ value }}" given. '
69- ): ChainedValidatorInterface ;
65+ ): ChainedValidatorInterface & Validator ;
7066
71- public function rule (RuleInterface $ constraint ): ChainedValidatorInterface ;
67+ public function rule (
68+ RuleInterface $ constraint
69+ ): ChainedValidatorInterface &Validator ;
7270
7371 public function timezone (
7472 int $ timezoneGroup = \DateTimeZone::ALL ,
7573 ?string $ countryCode = null ,
7674 string $ message = 'The "{{ name }}" value is not a valid timezone, "{{ value }}" given. '
77- ): ChainedValidatorInterface ;
75+ ): ChainedValidatorInterface & Validator ;
7876
7977 public function type (
8078 string |array $ constraint ,
8179 string $ message = 'The "{{ name }}" value should be of type "{{ constraint }}", "{{ value }}" given. '
82- ): ChainedValidatorInterface ;
80+ ): ChainedValidatorInterface & Validator ;
8381}
0 commit comments