Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62940fc

Browse files
committed
fix: reviews
1 parent 1f9a3a1 commit 62940fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Validator/Constraints/ChoiceValidator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public function validate($value, Constraint $constraint)
3535
throw new UnexpectedTypeException($constraint, Choice::class);
3636
}
3737

38-
if (!\is_array($constraint->choices) && !is_a($constraint->choices, \BackedEnum::class, true) && !$constraint->callback) {
38+
$valid = \is_array($constraint->choices)
39+
|| (\is_string($constraint->choices) && is_a($constraint->choices, \BackedEnum::class, true))
40+
|| isset($constraint->callback);
41+
42+
if (!$valid) {
3943
throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice.');
4044
}
4145

0 commit comments

Comments
 (0)