|
15 | 15 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
16 | 16 | use Symfony\Component\DependencyInjection\Definition;
|
17 | 17 | use Symfony\Component\DependencyInjection\Exception\LogicException;
|
| 18 | +use Symfony\Component\DependencyInjection\Exception\RuntimeException; |
18 | 19 |
|
19 | 20 | /**
|
20 | 21 | * @author Alexander M. Turek <me@derrabus.de>
|
@@ -99,11 +100,19 @@ protected function processValue($value, bool $isRoot = false)
|
99 | 100 | }
|
100 | 101 | }
|
101 | 102 |
|
102 |
| - if ($this->parameterAttributeConfigurators && $constructorReflector = $this->getConstructor($value, false)) { |
103 |
| - foreach ($constructorReflector->getParameters() as $parameterReflector) { |
104 |
| - foreach ($parameterReflector->getAttributes() as $attribute) { |
105 |
| - if ($configurator = $this->parameterAttributeConfigurators[$attribute->getName()] ?? null) { |
106 |
| - $configurator($conditionals, $attribute->newInstance(), $parameterReflector); |
| 103 | + if ($this->parameterAttributeConfigurators) { |
| 104 | + try { |
| 105 | + $constructorReflector = $this->getConstructor($value, false); |
| 106 | + } catch (RuntimeException $e) { |
| 107 | + $constructorReflector = null; |
| 108 | + } |
| 109 | + |
| 110 | + if ($constructorReflector) { |
| 111 | + foreach ($constructorReflector->getParameters() as $parameterReflector) { |
| 112 | + foreach ($parameterReflector->getAttributes() as $attribute) { |
| 113 | + if ($configurator = $this->parameterAttributeConfigurators[$attribute->getName()] ?? null) { |
| 114 | + $configurator($conditionals, $attribute->newInstance(), $parameterReflector); |
| 115 | + } |
107 | 116 | }
|
108 | 117 | }
|
109 | 118 | }
|
|
0 commit comments