Skip to content

Commit 54ff9d7

Browse files
committed
Avoiding an error when an unused service has a missing base class
This mirrors what was already done in AutowirePass
1 parent c33774c commit 54ff9d7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Compiler/ResolveBindingsPass.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
18+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1819
use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
1920
use Symfony\Component\DependencyInjection\TypedReference;
2021
use Symfony\Component\DependencyInjection\Reference;
@@ -88,8 +89,14 @@ protected function processValue($value, $isRoot = false)
8889

8990
$calls = $value->getMethodCalls();
9091

91-
if ($constructor = $this->getConstructor($value, false)) {
92-
$calls[] = array($constructor, $value->getArguments());
92+
try {
93+
if ($constructor = $this->getConstructor($value, false)) {
94+
$calls[] = array($constructor, $value->getArguments());
95+
}
96+
} catch (RuntimeException $e) {
97+
$this->container->getDefinition($this->currentId)->addError($e->getMessage());
98+
99+
return parent::processValue($value, $isRoot);
93100
}
94101

95102
foreach ($calls as $i => $call) {

0 commit comments

Comments
 (0)