8000 [DI] fix dumping lazy non-shared services · symfony/symfony@a4f4ca7 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4f4ca7

Browse files
[DI] fix dumping lazy non-shared services
1 parent 1382001 commit a4f4ca7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ protected function {$methodName}($lazyInitialization)
886886
if ($asFile) {
887887
$code = str_replace('$this', '$container', $code);
888888
$code = str_replace('function () {', 'function () use ($container) {', $code);
889+
$code = str_replace('function ($lazyLoad = true) {', 'function ($lazyLoad = true) use ($container) {', $code);
889890
}
890891

891892
$code .= " }\n";

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy_as_files.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class getNonSharedFooService extends ProjectServiceContainer
3030
{
3131
include_once $container->targetDir.''.'/Fixtures/includes/foo_lazy.php';
3232

33-
$container->facto 538F ries['non_shared_foo'] = function ($lazyLoad = true) {
33+
$container->factories['non_shared_foo'] = function ($lazyLoad = true) use ($container) {
3434
return new \Bar\FooLazyClass();
3535
};
3636

0 commit comments

Comments
 (0)
0