[DI] fix lazy factory code generation

This commit is contained in:
Nicolas Grekas 2020-04-23 14:56:02 +02:00
parent 69b6c90330
commit 7d55151ff4

View File

@ -851,7 +851,8 @@ EOF;
if ($this->getProxyDumper()->isProxyCandidate($definition)) {
$factoryCode = $asFile ? "\$this->load('%s', false)" : '$this->%s(false)';
$code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName));
$factoryCode = $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName));
$code .= $asFile ? preg_replace('/function \(([^)]*+)\) {/', 'function (\1) use ($container) {', $factoryCode) : $factoryCode;
}
$code .= $this->addServiceInclude($id, $definition);