Skip to content

Commit 29d1321

Browse files
Merge branch '3.4' into 4.0
* 3.4: [DomCrawler] Fix ChoiceFormField::select() PHPDoc [HttpFoundation] add tests for FlashBagInterface::setAll() Check for Hyper terminal on all operating systems. [DI] Don't show internal service id on binding errors Prevent toolbar links color override by css
2 parents b8ad455 + 946ab2c commit 29d1321

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Compiler/ResolveInstanceofConditionalsPass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
117117
}
118118
}
119119

120+
$definition->setBindings($bindings);
121+
120122
// reset fields with "merge" behavior
121123
$abstract
122-
->setBindings($bindings)
124+
->setBindings(array())
123125
->setArguments(array())
124126
->setMethodCalls(array())
125127
->setDecoratedService(null)

Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
1516
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
1718
use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass;
@@ -250,4 +251,18 @@ public function testMergeReset()
250251
$this->assertEmpty($abstract->getTags());
251252
$this->assertTrue($abstract->isAbstract());
252253
}
254+
255+
public function testBindings()
256+
{
257+
$container = new ContainerBuilder();
258+
$def = $container->register('foo', self::class)->setBindings(array('$toto' => 123));
259+
$def->setInstanceofConditionals(array(parent::class => new ChildDefinition('')));
260+
261+
(new ResolveInstanceofConditionalsPass())->process($container);
262+
263+
$bindings = $container->getDefinition('foo')->getBindings();
264+
$this->assertSame(array('$toto'), array_keys($bindings));
265+
$this->assertInstanceOf(BoundArgument::class, $bindings['$toto']);
266+
$this->assertSame(123, $bindings['$toto']->getValues()[0]);
267+
}
253268
}

0 commit comments

Comments
 (0)