File tree Expand file tree Collapse file tree 2 files changed +42
-16
lines changed
src/Validator/Constraints Expand file tree Collapse file tree 2 files changed +42
-16
lines changed Original file line number Diff line number Diff line change 18
18
symfony-version : 4.4.*
19
19
- php-version : 8.1
20
20
symfony-version : 4.4.*
21
+ - php-version : 7.2
22
+ symfony-version : 5.2.*
23
+ - php-version : 7.2
24
+ symfony-version : 5.3.*
21
25
- php-version : 7.2
22
26
symfony-version : 5.4.*
23
27
- php-version : 8.1
Original file line number Diff line number Diff line change @@ -42,23 +42,45 @@ public function __construct(
42
42
if (\is_string ($ enum )) {
43
43
$ this ->enum = $ enum ;
44
44
}
45
-
46
45
// Symfony 5.x Constraints has many constructor arguments for PHP 8.0 Attributes support
47
- parent ::__construct (
48
- null ,
49
- $ callback ,
50
- $ multiple ,
51
- $ strict ,
52
- $ min ,
53
- $ max ,
54
- $ message ,
55
- $ multipleMessage ,
56
- $ minMessage ,
57
- $ maxMessage ,
58
- $ groups ,
59
- $ payload ,
60
- $ options
61
- );
46
+
47
+ $ firstConstructorArg = (new \ReflectionClass (Choice::class))
48
+ ->getConstructor ()->getParameters ()[0 ]->getName ();
49
+ if ($ firstConstructorArg === 'choices ' ) {
50
+ // Prior to Symfony 5.3, first argument of Choice was $choices
51
+ parent ::__construct (
52
+ null ,
53
+ $ callback ,
54
+ $ multiple ,
55
+ $ strict ,
56
+ $ min ,
57
+ $ max ,
58
+ $ message ,
59
+ $ multipleMessage ,
60
+ $ minMessage ,
61
+ $ maxMessage ,
62
+ $ groups ,
63
+ $ payload ,
64
+ $ options
65
+ );
66
+ } else {
67
+ // Since Symfony 5.3, first argument of Choice is $options
68
+ parent ::__construct (
69
+ $ options ,
70
+ null ,
71
+ $ callback ,
72
+ $ multiple ,
73
+ $ strict ,
74
+ $ min ,
75
+ $ max ,
76
+ $ message ,
77
+ $ multipleMessage ,
78
+ $ minMessage ,
79
+ $ maxMessage ,
80
+ $ groups ,
81
+ $ payload
82
+ );
83
+ }
62
84
}
63
85
}
64
86
You can’t perform that action at this time.
0 commit comments