Skip to content

Commit 2162113

Browse files
nicolas-grekasfabpot
authored andcommitted
[DependencyInjection] Allow using expressions as service factories
1 parent 71b4a85 commit 2162113

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,7 @@ public function process(ContainerBuilder $container)
142142
[$bindingValue, $bindingId, , $bindingType, $bindingFile] = $binding->getValues();
143143
$binding->setValues([$bindingValue, $bindingId, true, $bindingType, $bindingFile]);
144144

145-
if (!$bindingValue instanceof Reference) {
146-
$args[$p->name] = new Reference('.value.'.$container->hash($bindingValue));
147-
$container->register((string) $args[$p->name], 'mixed')
148-
->setFactory('current')
149-
->addArgument([$bindingValue]);
150-
} else {
151-
$args[$p->name] = $bindingValue;
152-
}
145+
$args[$p->name] = $bindingValue;
153146

154147
continue;
155148
} elseif (!$autowire || (!($autowireAttributes ??= $p->getAttributes(Autowire::class)) && (!$type || '\\' !== $target[0]))) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"symfony/config": "^5.4|^6.0",
2929
"symfony/console": "^5.4|^6.0",
3030
"symfony/css-selector": "^5.4|^6.0",
31-
"symfony/dependency-injection": "^5.4|^6.0",
31+
"symfony/dependency-injection": "^6.1",
3232
"symfony/dom-crawler": "^5.4|^6.0",
3333
"symfony/expression-language": "^5.4|^6.0",
3434
"symfony/finder": "^5.4|^6.0",

0 commit comments

Comments
 (0)