File tree 2 files changed +16
-20
lines changed
src/Symfony/Component/Validator/Constraints
2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,14 @@ class Count extends Constraint
38
38
39
39
public function __construct ($ options = null )
40
40
{
41
- if (null !== $ options ) {
42
- if (!\is_array ($ options )) {
43
- $ options = [
44
- 'min ' => $ options ,
45
- 'max ' => $ options ,
46
- ];
47
- } elseif (isset ($ options ['value ' ]) && !isset ($ options ['min ' ]) && !isset ($ options ['max ' ])) {
48
- $ options ['min ' ] = $ options ['max ' ] = $ options ['value ' ];
49
- unset($ options ['value ' ]);
50
- }
41
+ if (null !== $ options && !\is_array ($ options )) {
42
+ $ options = [
43
+ 'min ' => $ options ,
44
+ 'max ' => $ options ,
45
+ ];
46
+ } elseif (\is_array ($ options ) && isset ($ options ['value ' ]) && !isset ($ options ['min ' ]) && !isset ($ options ['max ' ])) {
47
+ $ options ['min ' ] = $ options ['max ' ] = $ options ['value ' ];
48
+ unset($ options ['value ' ]);
51
49
}
52
50
53
51
parent ::__construct ($ options );
Original file line number Diff line number Diff line change @@ -42,16 +42,14 @@ class Length extends Constraint
42
42
43
43
public function __construct ($ options = null )
44
44
{
45
- if (null !== $ options ) {
46
- if (!\is_array ($ options )) {
47
- $ options = [
48
- 'min ' => $ options ,
49
- 'max ' => $ options ,
50
- ];
51
- } elseif (isset ($ options ['value ' ]) && !isset ($ options ['min ' ]) && !isset ($ options ['max ' ])) {
52
- $ options ['min ' ] = $ options ['max ' ] = $ options ['value ' ];
53
- unset($ options ['value ' ]);
54
- }
45
+ if (null !== $ options && !\is_array ($ options )) {
46
+ $ options = [
47
+ 'min ' => $ options ,
48
+ 'max ' => $ options ,
49
+ ];
50
+ } elseif (\is_array ($ options ) && isset ($ options ['value ' ]) && !isset ($ options ['min ' ]) && !isset ($ options ['max ' ])) {
51
+ $ options ['min ' ] = $ options ['max ' ] = $ options ['value ' ];
52
+ unset($ options ['value ' ]);
55
53
}
56
54
57
55
parent ::__construct ($ options );
You can’t perform that action at this time.
0 commit comments