Skip to content

Commit 1c7f39e

Browse files
committed
bug #62437 [DependencyInjection] Fix preloading LazyClosure (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [DependencyInjection] Fix preloading `LazyClosure` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Fixes this PHP warning when preloading a container that uses a lazy-closure: > Can't preload unlinked class Symfony\Component\DependencyInjection\Argument\LazyClosure@anonymous: Unknown parent Symfony\Component\DependencyInjection\Argument\LazyClosure Commits ------- 5baca4c [DependencyInjection] Fix preloading LazyClosure
2 parents 6a237fa + 5baca4c commit 1c7f39e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ private function addNewInstance(Definition $definition, string $return = '', ?st
12081208
|| ($callable[0] instanceof Definition && !$this->definitionVariables->offsetExists($callable[0]))
12091209
))) {
12101210
$initializer = 'fn () => '.$this->dumpValue($callable[0]);
1211+
$this->preload[LazyClosure::class] = LazyClosure::class;
12111212

12121213
return $return.LazyClosure::getCode($initializer, $callable, $class, $this->container, $id).$tail;
12131214
}

0 commit comments

Comments
 (0)