Skip to content

Commit a93e186

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: [HttpKernel] Fix message for unresovable arguments of invokable controllers [DependencyInjection] Process bindings in ServiceLocatorTagPass
2 parents c7b217e + 9065fe9 commit a93e186

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Compiler/ServiceLocatorTagPass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ protected function processValue($value, bool $isRoot = false)
4040
return self::register($this->container, $value->getValues());
4141
}
4242

43+
if ($value instanceof Definition) {
44+
$value->setBindings(parent::processValue($value->getBindings()));
45+
}
46+
4347
if (!$value instanceof Definition || !$value->hasTag('container.service_locator')) {
4448
return parent::processValue($value, $isRoot);
4549
}

Tests/Compiler/ServiceLocatorTagPassTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ public function testDefinitionOrderIsTheSame()
214214

215215
static::assertSame(['service-2', 'service-1'], array_keys($factories));
216216
}
217+
218+
public function testBindingsAreProcessed()
219+
{
220+
$container = new ContainerBuilder();
221+
222+
$definition = $container->register('foo')
223+
->setBindings(['foo' => new ServiceLocatorArgument()]);
224+
225+
(new ServiceLocatorTagPass())->process($container);
226+
227+
$this->assertInstanceOf(Reference::class, $definition->getBindings()['foo']->getValues()[0]);
228+
}
217229
}
218230

219231
class Locator

0 commit comments

Comments
 (0)