| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function validate($value, Constraint $constraint): void |
||
| 35 | { |
||
| 36 | if (!$constraint instanceof Enum) { |
||
| 37 | throw new RuntimeException(\sprintf('Object of class %s is not instance of %s', \get_class($constraint), Enum::class)); |
||
| 38 | } |
||
| 39 | |||
| 40 | if (!$constraint->entity) { |
||
| 41 | throw new ConstraintDefinitionException('Entity not specified.'); |
||
| 42 | } |
||
| 43 | |||
| 44 | $constraint->choices = $constraint->entity::getValues(); |
||
| 45 | |||
| 46 | parent::validate($value, $constraint); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |