Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
24 | 15 | public function resolve(Request $request, ArgumentMetadata $argument) |
|
25 | { |
||
26 | /** @var ConstraintViolationListInterface|null $errorsQueue */ |
||
27 | 15 | $violationList = $request->attributes->get(self::REQUEST_ATTR_KEY); |
|
28 | |||
29 | 15 | if ($violationList === null) { |
|
30 | 1 | throw new \InvalidArgumentException( |
|
31 | 1 | sprintf( |
|
32 | 1 | 'The action argument "%s \$%s" is required.', |
|
33 | 1 | (string) $argument->getType(), |
|
34 | 1 | $argument->getName() |
|
35 | ) |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | 14 | $request->attributes->remove(self::REQUEST_ATTR_KEY); |
|
40 | |||
41 | 14 | if ($argument->isNullable() && $violationList->count() === 0) { |
|
42 | 2 | $violationList = null; |
|
43 | } |
||
44 | |||
45 | 14 | yield $violationList; |
|
46 | 14 | } |
|
48 |