File tree 4 files changed +44
-20
lines changed
src/Symfony/Component/Validator/Constraints
4 files changed +44
-20
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,21 @@ class Negative extends LessThan
25
25
26
26
public function __construct ($ options = null )
27
27
{
28
- if (isset ( $ options[ ' propertyPath ' ]) ) {
29
- throw new ConstraintDefinitionException ( sprintf ( ' The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ( $ this )) );
28
+ if (null === $ options ) {
29
+ $ options = array ( );
30
30
}
31
31
32
- if (isset ($ options ['value ' ])) {
33
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
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
+ }
36
+
37
+ if (isset ($ options ['value ' ])) {
38
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
+ }
34
40
}
35
41
36
- parent ::__construct (array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
37
43
}
38
44
39
45
public function validatedBy ()
Original file line number Diff line number Diff line change @@ -25,15 +25,21 @@ class NegativeOrZero extends LessThanOrEqual
25
25
26
26
public function __construct ($ options = null )
27
27
{
28
- if (isset ( $ options[ ' propertyPath ' ]) ) {
29
- throw new ConstraintDefinitionException ( sprintf ( ' The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ( $ this )) );
28
+ if (null === $ options ) {
29
+ $ options = array ( );
30
30
}
31
31
32
- if (isset ($ options ['value ' ])) {
33
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
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
+ }
36
+
37
+ if (isset ($ options ['value ' ])) {
38
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
+ }
34
40
}
35
41
36
- parent ::__construct (array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
37
43
}
38
44
39
45
public function validatedBy ()
Original file line number Diff line number Diff line change @@ -25,15 +25,21 @@ class Positive extends GreaterThan
25
25
26
26
public function __construct ($ options = null )
27
27
{
28
- if (isset ( $ options[ ' propertyPath ' ]) ) {
29
- throw new ConstraintDefinitionException ( sprintf ( ' The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ( $ this )) );
28
+ if (null === $ options ) {
29
+ $ options = array ( );
30
30
}
31
31
32
- if (isset ($ options ['value ' ])) {
33
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
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
+ }
36
+
37
+ if (isset ($ options ['value ' ])) {
38
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
+ }
34
40
}
35
41
36
- parent ::__construct (array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
37
43
}
38
44
39
45
public function validatedBy ()
Original file line number Diff line number Diff line change @@ -25,15 +25,21 @@ class PositiveOrZero extends GreaterThanOrEqual
25
25
26
26
public function __construct ($ options = null )
27
27
{
28
- if (isset ( $ options[ ' propertyPath ' ]) ) {
29
- throw new ConstraintDefinitionException ( sprintf ( ' The "propertyPath" option of the "%s" constraint cannot be set. ' , \get_class ( $ this )) );
28
+ if (null === $ options ) {
29
+ $ options = array ( );
30
30
}
31
31
32
- if (isset ($ options ['value ' ])) {
33
- throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
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
+ }
36
+
37
+ if (isset ($ options ['value ' ])) {
38
+ throw new ConstraintDefinitionException (sprintf ('The "value" option of the "%s" constraint cannot be set. ' , \get_class ($ this )));
39
+ }
34
40
}
35
41
36
- parent ::__construct (array_merge ((array ) $ options , array ('value ' => 0 )));
42
+ parent ::__construct ($ options = array_merge ((array ) $ options , array ('value ' => 0 )));
37
43
}
38
44
39
45
public function validatedBy ()
You can’t perform that action at this time.
0 commit comments