Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f277dbb

Browse filesBrowse files
committed
[DI] Fix decorated service merge in ResolveInstanceofConditionalsPass
1 parent e48617b commit f277dbb
Copy full SHA for f277dbb

File tree

2 files changed

+28
-0
lines changed
Filter options

2 files changed

+28
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
1717
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
19+
use Symfony\Component\DependencyInjection\Definition;
1920

2021
class ResolveInstanceofConditionalsPassTest extends TestCase
2122
{
@@ -224,4 +225,30 @@ public function testProcessThrowsExceptionForArguments()
224225

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.