7
7
8
8
interface ChainedValidatorInterface
9
9
{
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
-
24
10
public function choice (
25
11
array $ constraints ,
26
12
bool $ multiple = false ,
@@ -30,54 +16,66 @@ public function choice(
30
16
string $ multipleMessage = 'The "{{ name }}" value has one or more invalid choices, "{{ value }}" given. Accepted values are: "{{ constraints }}". ' ,
31
17
string $ minMessage = 'The "{{ name }}" value must have at least {{ minConstraint }} choices, {{ numValues }} choices given. ' ,
32
18
string $ maxMessage = 'The "{{ name }}" value must have at most {{ maxConstraint }} choices, {{ numValues }} choices given. '
33
- ): ChainedValidatorInterface ;
19
+ ): ChainedValidatorInterface & Validator ;
34
20
35
21
public function country (
36
22
string $ code = 'alpha-2 ' ,
37
23
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 ;
39
35
40
36
public function greaterThan (
41
37
mixed $ constraint ,
42
38
string $ message = 'The "{{ name }}" value should be greater than "{{ constraint }}", "{{ value }}" given. '
43
- ): ChainedValidatorInterface ;
39
+ ): ChainedValidatorInterface & Validator ;
44
40
45
41
public function greaterThanOrEqual (
46
42
mixed $ constraint ,
47
43
string $ message = 'The "{{ name }}" value should be greater than or equal to "{{ constraint }}", "{{ value }}" given. '
48
- ): ChainedValidatorInterface ;
44
+ ): ChainedValidatorInterface & Validator ;
49
45
50
46
public function lessThan (
51
47
mixed $ constraint ,
52
48
string $ message = 'The "{{ name }}" value should be less than "{{ constraint }}", "{{ value }}" given. '
53
- ): ChainedValidatorInterface ;
49
+ ): ChainedValidatorInterface & Validator ;
54
50
55
51
public function lessThanOrEqual (
56
52
mixed $ constraint ,
57
53
string $ message = 'The "{{ name }}" value should be less than or equal to "{{ constraint }}", "{{ value }}" given. '
58
- ): ChainedValidatorInterface ;
54
+ ): ChainedValidatorInterface & Validator ;
59
55
60
56
public function notBlank (
61
57
?callable $ normalizer = null ,
62
58
string $ message = 'The "{{ name }}" value should not be blank, "{{ value }}" given. '
63
- ): ChainedValidatorInterface ;
59
+ ): ChainedValidatorInterface & Validator ;
64
60
65
61
public function range (
66
62
mixed $ minConstraint ,
67
63
mixed $ maxConstraint ,
68
64
string $ message = 'The "{{ name }}" value should be between "{{ minConstraint }}" and "{{ maxConstraint }}", "{{ value }}" given. '
69
- ): ChainedValidatorInterface ;
65
+ ): ChainedValidatorInterface & Validator ;
70
66
71
- public function rule (RuleInterface $ constraint ): ChainedValidatorInterface ;
67
+ public function rule (
68
+ RuleInterface $ constraint
69
+ ): ChainedValidatorInterface &Validator ;
72
70
73
71
public function timezone (
74
72
int $ timezoneGroup = \DateTimeZone::ALL ,
75
73
?string $ countryCode = null ,
76
74
string $ message = 'The "{{ name }}" value is not a valid timezone, "{{ value }}" given. '
77
- ): ChainedValidatorInterface ;
75
+ ): ChainedValidatorInterface & Validator ;
78
76
79
77
public function type (
80
78
string |array $ constraint ,
81
79
string $ message = 'The "{{ name }}" value should be of type "{{ constraint }}", "{{ value }}" given. '
82
- ): ChainedValidatorInterface ;
80
+ ): ChainedValidatorInterface & Validator ;
83
81
}
0 commit comments