You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewConstraintDefinitionException(\sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, static::class));
62
+
if (!\is_array($nestedConstraints)) {
63
+
$nestedConstraints = [$nestedConstraints];
73
64
}
74
65
75
-
if ($constraintinstanceof Valid) {
76
-
thrownewConstraintDefinitionException(\sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', static::class));
77
-
}
78
-
}
66
+
foreach ($nestedConstraintsas$constraint) {
67
+
if (!$constraintinstanceof Constraint) {
68
+
if (\is_object($constraint)) {
69
+
$constraint = get_debug_type($constraint);
70
+
}
79
71
80
-
if (!isset(((array) $this)['groups'])) {
81
-
$mergedGroups = [];
72
+
thrownewConstraintDefinitionException(\sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, get_debug_type($this)));
73
+
}
82
74
83
-
foreach ($nestedConstraintsas$constraint) {
84
-
foreach ($constraint->groupsas$group) {
85
-
$mergedGroups[$group] = true;
75
+
if ($constraintinstanceof Valid) {
76
+
thrownewConstraintDefinitionException(\sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', get_debug_type($this)));
86
77
}
87
78
}
88
79
89
-
// prevent empty composite constraint to have empty groups
thrownewConstraintDefinitionException(\sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), get_debug_type($constraint), static::class));
thrownewConstraintDefinitionException(\sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), get_debug_type($constraint), get_debug_type($this)));
102
+
}
103
+
} else {
104
+
$constraint->groups = $this->groups;
102
105
}
103
-
} else {
104
-
$constraint->groups = $this->groups;
105
106
}
106
-
}
107
107
108
-
$this->$compositeOption = $nestedConstraints;
108
+
$this->$option = $nestedConstraints;
109
+
}
109
110
}
110
111
111
112
/**
@@ -115,18 +116,20 @@ public function addImplicitGroupName(string $group): void
thrownewLogicException(\sprintf('The "symfony/expression-language" component is required to use the "%s" constraint. Try running "composer require symfony/expression-language".', __CLASS__));
@@ -56,12 +58,17 @@ public function __construct(string|Expression|array $expression, array|Constrain
56
58
57
59
$options['expression'] = $expression;
58
60
$options['constraints'] = $constraints;
61
+
$options['otherwise'] = $otherwise;
59
62
}
60
63
61
-
if (isset($options['constraints']) && !\is_array($options['constraints'])) {
0 commit comments