Skip to content

Commit f40512c

Browse files
[DependencyInjection][VarExporter] Generate lazy proxies for non-ghostable lazy services out of the box
1 parent 98a95e9 commit f40512c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020
use Symfony\Component\DependencyInjection\ContainerInterface;
2121
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
22-
use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
2322
use Symfony\Component\DependencyInjection\Reference;
2423
use Symfony\Component\DependencyInjection\TypedReference;
2524
use Symfony\Component\HttpFoundation\Request;
2625
use Symfony\Component\HttpFoundation\Session\SessionInterface;
26+
use Symfony\Component\VarExporter\ProxyHelper;
2727

2828
/**
2929
* Creates the service-locators required by ServiceValueResolver.
@@ -120,7 +120,7 @@ public function process(ContainerBuilder $container)
120120
$args = [];
121121
foreach ($parameters as $p) {
122122
/** @var \ReflectionParameter $p */
123-
$type = ltrim($target = (string) ProxyHelper::getTypeHint($r, $p), '\\');
123+
$type = preg_replace('/(^|[(|&])\\\\/', '\1', $target = ltrim(ProxyHelper::exportType($p) ?? '', '?'));
124124
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
125125
$autowireAttributes = $autowire ? $emptyAutowireAttributes : [];
126126

@@ -183,7 +183,7 @@ public function process(ContainerBuilder $container)
183183

184184
$args[$p->name] = new Reference($erroredId, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE);
185185
} else {
186-
$target = ltrim($target, '\\');
186+
$target = preg_replace('/(^|[(|&])\\\\/', '\1', $target);
187187
$args[$p->name] = $type ? new TypedReference($target, $type, $invalidBehavior, Target::parseName($p)) : new Reference($target, $invalidBehavior);
188188
}
189189
}

0 commit comments

Comments
 (0)