Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
31 | 2 | public function error(string $field, ?ConstraintViolationListInterface $errors): iterable |
|
32 | { |
||
33 | 2 | if (is_null($errors)) { |
|
34 | 1 | return; |
|
35 | } |
||
36 | |||
37 | /** @var ConstraintViolationInterface $error */ |
||
38 | 1 | foreach ($errors as $error) { |
|
39 | 1 | if ($error->getPropertyPath() == $field) { |
|
40 | 1 | yield $error->getMessage(); |
|
41 | } |
||
42 | } |
||
43 | 1 | } |
|
44 | } |
||
45 |