8000 Fix ResolveDefinitionInheritancePass · symfony/symfony@d08ba63 · GitHub
[go: up one dir, main page]

Skip to content

Commit d08ba63

Browse files
Fix ResolveDefinitionInheritancePass
1 parent d47571f commit d08ba63

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionInheritancePass.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ protected function processValue($value, $isRoot = false)
2626
if (!$value instanceof Definition) {
2727
return parent::processValue($value, $isRoot);
2828
}
29-
if ($value instanceof ChildDefinition) {
30-
$this->resolveDefinition($value);
31-
}
32-
$class = $value->getClass();
29+
30+
$class = $value instanceof ChildDefinition ? $this->resolveDefinition($value) : $value->getClass();
31+
3332
if (!$class || false !== strpos($class, '%') || !$instanceof = $value->getInstanceofConditionals()) {
3433
return parent::processValue($value, $isRoot);
3534
}
35+
$value->setInstanceofConditionals(array());
3636

3737
foreach ($instanceof as $interface => $definition) {
3838
if ($interface !== $class && (!$this->container->getReflectionClass($interface) || !$this->container->getReflectionClass($class))) {
@@ -56,24 +56,21 @@ private function resolveDefinition(ChildDefinition $definition)
5656
}
5757

5858
$parentDef = $this->container->findDefinition($parent);
59-
if ($parentDef instanceof ChildDefinition) {
60-
$this->resolveDefinition($parentDef);
61-
}
62-
63-
if (!isset($definition->getChanges()['class'])) {
64-
$definition->setClass($parentDef->getClass());
65-
}
59+
$class = $parentDef instanceof ChildDefinition ? $this->resolveDefinition($parentDef) : $parentDef->getClass();
60+
$class = $definition->getClass() ?: $class;
6661

6762
// append parent tags when inheriting is enabled
6863
if ($definition->getInheritTags()) {
64+
$definition->setInheritTags(false);
65+
6966
foreach ($parentDef->getTags() as $k => $v) {
7067
foreach ($v as $v) {
7168
$definition->addTag($k, $v);
7269
}
7370
}
7471
}
7572

76-
$definition->setInheritTags(false);
73+
return $class;
7774
}
7875

7976
private function mergeDefinition(Definition $def, ChildDefinition $definition)

0 commit comments

Comments
 (0)
0