File tree 4 files changed +48
-40
lines changed
src/Symfony/Component/Validator/Constraints
4 files changed +48
-40
lines changed Original file line number Diff line number Diff line change @@ -27,23 +27,25 @@ public function __construct($options = null)
27
27
{
28
28
if (null === $ options ) {
29
29
$ options = array ();
30
+ } elseif (!is_array ($ options )) {
31
+ $ options = array ($ this ->getDefaultOption () => $ options );
30
32
}
31
33
32
- if (\is_array ($ options )) {
33
- if (isset ($ options ['propertyPath ' ])) {
34
- throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
35
- }
34
+ if (isset ($ options ['propertyPath ' ])) {
35
+ throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
36
+ }
36
37
37
- if (isset ($ options ['value ' ])) {
38
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
- }
38
+ if (isset ($ options ['value ' ])) {
39
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
40
40
}
41
41
42
- parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ $ options ['value ' ] = 0 ;
43
+
44
+ parent ::__construct ($ options );
43
45
}
44
46
45
- public function validatedBy ()
47
+ public function validatedBy (): string
46
48
{
47
- return ' LessThanValidator ' ;
49
+ return LessThanValidator::class ;
48
50
}
49
51
}
Original file line number Diff line number Diff line change @@ -27,23 +27,25 @@ public function __construct($options = null)
27
27
{
28
28
if (null === $ options ) {
29
29
$ options = array ();
30
+ } elseif (!is_array ($ options )) {
31
+ $ options = array ($ this ->getDefaultOption () => $ options );
30
32
}
31
33
32
- if (\is_array ($ options )) {
33
- if (isset ($ options ['propertyPath ' ])) {
34
- throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
35
- }
34
+ if (isset ($ options ['propertyPath ' ])) {
35
+ throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
36
+ }
36
37
37
- if (isset ($ options ['value ' ])) {
38
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
- }
38
+ if (isset ($ options ['value ' ])) {
39
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
40
40
}
41
41
42
- parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ $ options ['value ' ] = 0 ;
43
+
44
+ parent ::__construct ($ options );
43
45
}
44
46
45
- public function validatedBy ()
47
+ public function validatedBy (): string
46
48
{
47
- return ' LessThanOrEqualValidator ' ;
49
+ return LessThanOrEqualValidator::class ;
48
50
}
49
51
}
Original file line number Diff line number Diff line change @@ -27,23 +27,25 @@ public function __construct($options = null)
27
27
{
28
28
if (null === $ options ) {
29
29
$ options = array ();
30
+ } elseif (!is_array ($ options )) {
31
+ $ options = array ($ this ->getDefaultOption () => $ options );
30
32
}
31
33
32
- if (\is_array ($ options )) {
33
- if (isset ($ options ['propertyPath ' ])) {
34
- throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
35
- }
34
+ if (isset ($ options ['propertyPath ' ])) {
35
+ throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
36
+ }
36
37
37
- if (isset ($ options ['value ' ])) {
38
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
- }
38
+ if (isset ($ options ['value ' ])) {
39
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
40
40
}
41
41
42
- parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ $ options ['value ' ] = 0 ;
43
+
44
+ parent ::__construct ($ options );
43
45
}
44
46
45
- public function validatedBy ()
47
+ public function validatedBy (): string
46
48
{
47
- return ' GreaterThanValidator ' ;
49
+ return GreaterThanValidator::class ;
48
50
}
49
51
}
Original file line number Diff line number Diff line change @@ -27,23 +27,25 @@ public function __construct($options = null)
27
27
{
28
28
if (null === $ options ) {
29
29
$ options = array ();
30
+ } elseif (!is_array ($ options )) {
31
+ $ options = array ($ this ->getDefaultOption () => $ options );
30
32
}
31
33
32
- if (\is_array ($ options )) {
33
- if (isset ($ options ['propertyPath ' ])) {
34
- throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
35
- }
34
+ if (isset ($ options ['propertyPath ' ])) {
35
+ throw new ConstraintDefinitionException (sprintf ('The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
36
+ }
36
37
37
- if (isset ($ options ['value ' ])) {
38
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
- }
38
+ if (isset ($ options ['value ' ])) {
39
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
40
40
}
41
41
42
- parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ $ options ['value ' ] = 0 ;
43
+
44
+ parent ::__construct ($ options );
43
45
}
44
46
45
- public function validatedBy ()
47
+ public function validatedBy (): string
46
48
{
47
- return ' GreaterThanOrEqualValidator ' ;
49
+ return GreaterThanOrEqualValidator::class ;
48
50
}
49
51
}
You can’t perform that action at this time.
0 commit comments