Skip to content

Commit 047fb12

Browse files
Merge branch '4.0' into 4.1
* 4.0: [DomCrawler] Fix ChoiceFormField::select() PHPDoc [Security] LdapUserProvider uidKey could be null [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 0aff03d + 29d1321 commit 047fb12

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Compiler/ResolveInstanceofConditionalsPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition
123123
}
124124

125125
$definition->setMethodCalls(array_merge($instanceofCalls, $definition->getMethodCalls()));
126+
$definition->setBindings($bindings);
126127

127128
// reset fields with "merge" behavior
128129
$abstract
129-
->setBindings($bindings)
130+
->setBindings(array())
130131
->setArguments(array())
131132
->setMethodCalls(array())
132133
->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;
@@ -268,4 +269,18 @@ public function testMergeReset()
268269
$this->assertEmpty($abstract->getTags());
269270
$this->assertTrue($abstract->isAbstract());
270271
}
272+
273+
public function testBindings()
274+
{
275+
$container = new ContainerBuilder();
276+
$def = $container->register('foo', self::class)->setBindings(array('$toto' => 123));
277+
$def->setInstanceofConditionals(array(parent::class => new ChildDefinition('')));
278+
279+
(new ResolveInstanceofConditionalsPass())->process($container);
280+
281+
$bindings = $container->getDefinition('foo')->getBindings();
282+
$this->assertSame(array('$toto'), array_keys($bindings));
283+
$this->assertInstanceOf(BoundArgument::class, $bindings['$toto']);
284+
$this->assertSame(123, $bindings['$toto']->getValues()[0]);
285+
}
271286
}

0 commit comments

Comments
 (0)