8000 [DI] Fix decorated service merge in ResolveInstanceofConditionalsPass · iamluc/symfony@2a30908 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a30908

Browse files
committed
[DI] Fix decorated service merge in ResolveInstanceofConditionalsPass
1 parent e48617b commit 2a30908

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
119119
$abstract
120120
->setArguments(array())
121121
->setMethodCalls(array())
122+
->setDecoratedService(null)
122123
->setTags(array())
123124
->setAbstract(true);
124125
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,30 @@ public function testProcessThrowsExceptionForArguments()
224224

225225
(new ResolveInstanceofConditionalsPass())->process($container);
226226
}
227+
228+
public function testMergeReset()
229+
{
230+
$container = new ContainerBuilder();
231+
232+
$container
233+
->register('bar', self::class)
234+
->addArgument('a')
235+
->addMethodCall('setB')
236+
->setDecoratedService('foo')
237+
->addTag('t')
238+
->setInstanceofConditionals(array(
239+
parent::class => (new ChildDefinition(''))->addTag('bar'),
240+
))
241+
;
242+
243+
(new ResolveInstanceofConditionalsPass())->process($container);
244+
245+
$abstract = $container->getDefinition('abstract.instanceof.bar');
246+
247+
$this->assertEmpty($abstract->getArguments());
248+
$this->assertEmpty($abstract->getMethodCalls());
249+
$this->assertNull($abstract->getDecoratedService());
250+
$this->assertEmpty($abstract->getTags());
251+
$this->assertTrue($abstract->isAbstract());
252+
}
227253
}

0 commit comments

Comments
 (0)
0