Skip to content

Commit

Permalink
bug #36548 [DI] fix lazy factory code generation (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] fix lazy factory code generation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #36547
| License       | MIT
| Doc PR        | -

Commits
-------

7d55151 [DI] fix lazy factory code generation
  • Loading branch information
fabpot committed Apr 24, 2020
2 parents d6b9011 + 7d55151 commit 69452b2
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -851,7 +851,8 @@ protected function {$methodName}($lazyInitialization)

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);
Expand Down

0 comments on commit 69452b2

Please sign in to comment.