diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 6e31079ef726e..2aa53d0fa9190 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -244,7 +244,7 @@ public function dump(array $options = []): string|array if ($this->addGetService) { $code = preg_replace( "/(\r?\n\r?\n public function __construct.+?\\{\r?\n) ++([^\r\n]++)/s", - "\n protected \Closure \$getService;$1 \$containerRef = $2\n \$this->getService = static function () use (\$containerRef) { return \$containerRef->get()->getService(...\\func_get_args()); };", + "\n protected \Closure \$getService;$1 \$containerRef = $2\n \$this->getService = function () use (\$containerRef) { return \$containerRef->get()->getService(...\\func_get_args()); };", $code, 1 ); @@ -941,7 +941,7 @@ protected static function {$methodName}(\$container$lazyInitialization) $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $line, explode("\n", $c))); $lazyloadInitialization = $definition->isLazy() ? ', $lazyLoad = true' : ''; - $c = sprintf(" %s = static function (\$container%s) {\n%s };\n\n return %1\$s(\$container);\n", $factory, $lazyloadInitialization, $c); + $c = sprintf(" %s = function (\$container%s) {\n%s };\n\n return %1\$s(\$container);\n", $factory, $lazyloadInitialization, $c); } $code .= $c; @@ -1545,7 +1545,7 @@ private function addInlineRequires(bool $hasProxyClasses): string $code .= "\n include_once __DIR__.'/proxy-classes.php';"; } - return $code ? sprintf("\n \$this->privates['service_container'] = static function (\$container) {%s\n };\n", $code) : ''; + return $code ? sprintf("\n \$this->privates['service_container'] = function (\$container) {%s\n };\n", $code) : ''; } private function addDefaultParametersMethod(): string @@ -1831,7 +1831,7 @@ private function dumpValue(mixed $value, bool $interpolate = true): string } $this->addContainerRef = true; - return sprintf("%sstatic function () use (\$containerRef)%s {\n \$container = \$containerRef->get();\n\n %s\n }", $attribute, $returnedType, $code); + return sprintf("%sfunction () use (\$containerRef)%s {\n \$container = \$containerRef->get();\n\n %s\n }", $attribute, $returnedType, $code); } if ($value instanceof IteratorArgument) { @@ -1839,15 +1839,15 @@ private function dumpValue(mixed $value, bool $interpolate = true): string $code = []; if (!$values = $value->getValues()) { - $code[] = 'new RewindableGenerator(static function () {'; + $code[] = 'new RewindableGenerator(function () {'; $code[] = ' return new \EmptyIterator();'; } else { $this->addContainerRef = true; - $code[] = 'new RewindableGenerator(static function () use ($containerRef) {'; + $code[] = 'new RewindableGenerator(function () use ($containerRef) {'; $code[] = ' $container = $containerRef->get();'; $code[] = ''; $countCode = []; - $countCode[] = 'static function () use ($containerRef) {'; + $countCode[] = 'function () use ($containerRef) {'; foreach ($values as $k => $v) { ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/closure.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/closure.php index c231064711667..1444190c5b645 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/closure.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/closure.php @@ -66,7 +66,7 @@ protected static function getClosureOfServiceClosureService($container) { $containerRef = $container->ref; - return $container->services['closure_of_service_closure'] = #[\Closure(name: 'bar2', class: 'stdClass')] static function () use ($containerRef) { + return $container->services['closure_of_service_closure'] = #[\Closure(name: 'bar2', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->privates['bar2'] ??= new \stdClass()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10_as_files.txt index ba1bbd6ec9912..c6e71e52e1b5f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10_as_files.txt @@ -31,7 +31,7 @@ class getClosureService extends ProjectServiceContainer $container->services['closure'] = $instance = new \stdClass(); - $instance->closures = [#[\Closure(name: 'foo', class: 'FooClass')] static function () use ($containerRef): ?\stdClass { + $instance->closures = [#[\Closure(name: 'foo', class: 'FooClass')] function () use ($containerRef): ?\stdClass { $container = $containerRef->get(); return ($container->services['foo'] ?? null); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index 461787826da66..9a5026f304b15 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -319,7 +319,7 @@ class getFooBarService extends ProjectServiceContainer */ public static function do($container, $lazyLoad = true) { - $container->factories['foo_bar'] = static function ($container) { + $container->factories['foo_bar'] = function ($container) { return new \Bar\FooClass(($container->services['deprecated_service'] ?? $container->load('getDeprecatedServiceService'))); }; @@ -363,12 +363,12 @@ class getLazyContextService extends ProjectServiceContainer { $containerRef = $container->ref; - return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 'k1' => ($container->services['foo.baz'] ?? $container->load('getFoo_BazService')); yield 'k2' => $container; - }, 2), new RewindableGenerator(static function () { + }, 2), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -387,11 +387,11 @@ class getLazyContextIgnoreInvalidRefService extends ProjectServiceContainer { $containerRef = $container->ref; - return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo.baz'] ?? $container->load('getFoo_BazService')); - }, 1), new RewindableGenerator(static function () { + }, 1), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -455,7 +455,7 @@ class getNonSharedFooService extends ProjectServiceContainer { include_once $container->targetDir.''.'/Fixtures/includes/foo.php'; - $container->factories['non_shared_foo'] = static function ($container) { + $container->factories['non_shared_foo'] = function ($container) { return new \Bar\FooClass(); }; @@ -521,7 +521,7 @@ class getTaggedIteratorService extends ProjectServiceContainer { $containerRef = $container->ref; - return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo'] ?? $container->load('getFooService')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 7b4c50ffb94d7..cec7e9798c764 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -298,7 +298,7 @@ protected static function getFoo_BazService($container) */ protected static function getFooBarService($container) { - $container->factories['foo_bar'] = static function ($container) { + $container->factories['foo_bar'] = function ($container) { return new \Bar\FooClass(($container->services['deprecated_service'] ?? self::getDeprecatedServiceService($container))); }; @@ -332,12 +332,12 @@ protected static function getLazyContextService($container) { $containerRef = $container->ref; - return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 'k1' => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); yield 'k2' => $container; - }, 2), new RewindableGenerator(static function () { + }, 2), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -351,11 +351,11 @@ protected static function getLazyContextIgnoreInvalidRefService($container) { $containerRef = $container->ref; - return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); - }, 1), new RewindableGenerator(static function () { + }, 1), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -434,7 +434,7 @@ protected static function getTaggedIteratorService($container) { $containerRef = $container->ref; - return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo'] ?? self::getFooService($container)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt index b561ff647f05c..b6fb7fe482a6d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt @@ -86,7 +86,7 @@ class ProjectServiceContainer extends Container 'decorated' => 'decorator_service_with_name', ]; - $this->privates['service_container'] = static function ($container) { + $this->privates['service_container'] = function ($container) { include_once $container->targetDir.''.'/Fixtures/includes/foo.php'; }; } @@ -319,7 +319,7 @@ class ProjectServiceContainer extends Container */ protected static function getFooBarService($container) { - $container->factories['foo_bar'] = static function ($container) { + $container->factories['foo_bar'] = function ($container) { return new \Bar\FooClass(($container->services['deprecated_service'] ?? self::getDeprecatedServiceService($container))); }; @@ -355,12 +355,12 @@ class ProjectServiceContainer extends Container include_once $container->targetDir.''.'/Fixtures/includes/classes.php'; - return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 'k1' => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); yield 'k2' => $container; - }, 2), new RewindableGenerator(static function () { + }, 2), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -376,11 +376,11 @@ class ProjectServiceContainer extends Container include_once $container->targetDir.''.'/Fixtures/includes/classes.php'; - return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); - }, 1), new RewindableGenerator(static function () { + }, 1), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -429,7 +429,7 @@ class ProjectServiceContainer extends Container { include_once $container->targetDir.''.'/Fixtures/includes/foo.php'; - $container->factories['non_shared_foo'] = static function ($container) { + $container->factories['non_shared_foo'] = function ($container) { return new \Bar\FooClass(); }; @@ -475,7 +475,7 @@ class ProjectServiceContainer extends Container { $containerRef = $container->ref; - return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo'] ?? self::getFooService($container)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt index 965dc91661cce..21cbc4a3ff1b1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt @@ -48,7 +48,7 @@ class ProjectServiceContainer extends Container $this->aliases = []; - $this->privates['service_container'] = static function ($container) { + $this->privates['service_container'] = function ($container) { include_once __DIR__.'/proxy-classes.php'; }; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php index 0bcd17e9e5fb7..f48ced0ebc0f0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_private.php @@ -201,7 +201,7 @@ protected static function getDoctrine_EntityManagerService($container) $containerRef = $container->ref; $a = new \stdClass(); - $a->resolver = new \stdClass(new RewindableGenerator(static function () use ($containerRef) { + $a->resolver = new \stdClass(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->privates['doctrine.listener'] ?? self::getDoctrine_ListenerService($container)); @@ -528,7 +528,7 @@ protected static function getMailer_TransportService($container) { $containerRef = $container->ref; - return $container->privates['mailer.transport'] = (new \FactoryCircular(new RewindableGenerator(static function () use ($containerRef) { + return $container->privates['mailer.transport'] = (new \FactoryCircular(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->privates['mailer.transport_factory.amazon'] ?? self::getMailer_TransportFactory_AmazonService($container)); @@ -559,7 +559,7 @@ protected static function getMailer_TransportFactory_AmazonService($container) */ protected static function getMailerInline_MailerService($container) { - return $container->privates['mailer_inline.mailer'] = new \stdClass((new \FactoryCircular(new RewindableGenerator(static function () { + return $container->privates['mailer_inline.mailer'] = new \stdClass((new \FactoryCircular(new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)))->create()); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php index b1d80181f8fa9..2c306549ec483 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_almost_circular_public.php @@ -275,7 +275,7 @@ protected static function getDoctrine_EntityListenerResolverService($container) { $containerRef = $container->ref; - return $container->services['doctrine.entity_listener_resolver'] = new \stdClass(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['doctrine.entity_listener_resolver'] = new \stdClass(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['doctrine.listener'] ?? self::getDoctrine_ListenerService($container)); @@ -356,7 +356,7 @@ protected static function getFoo2Service($container) */ protected static function getFoo4Service($container) { - $container->factories['foo4'] = static function ($container) { + $container->factories['foo4'] = function ($container) { $instance = new \stdClass(); $instance->foobar = ($container->services['foobar4'] ?? self::getFoobar4Service($container)); @@ -528,7 +528,7 @@ protected static function getMailer_TransportFactoryService($container) { $containerRef = $container->ref; - return $container->services['mailer.transport_factory'] = new \FactoryCircular(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['mailer.transport_factory'] = new \FactoryCircular(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['mailer.transport_factory.amazon'] ?? self::getMailer_TransportFactory_AmazonService($container)); @@ -559,7 +559,7 @@ protected static function getMailer_TransportFactory_AmazonService($container) */ protected static function getMailerInline_TransportFactoryService($container) { - return $container->services['mailer_inline.transport_factory'] = new \FactoryCircular(new RewindableGenerator(static function () { + return $container->services['mailer_inline.transport_factory'] = new \FactoryCircular(new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_closure_argument_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_closure_argument_compiled.php index ca6262cb29d17..111ebd4506978 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_closure_argument_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_closure_argument_compiled.php @@ -59,7 +59,7 @@ protected static function getServiceClosureService($container) { $containerRef = $container->ref; - return $container->services['service_closure'] = new \Bar(#[\Closure(name: 'foo', class: 'Foo')] static function () use ($containerRef) { + return $container->services['service_closure'] = new \Bar(#[\Closure(name: 'foo', class: 'Foo')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['foo'] ??= new \Foo()); @@ -75,7 +75,7 @@ protected static function getServiceClosureInvalidService($container) { $containerRef = $container->ref; - return $container->services['service_closure_invalid'] = new \Bar(static function () use ($containerRef) { + return $container->services['service_closure_invalid'] = new \Bar(function () use ($containerRef) { $container = $containerRef->get(); return NULL; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php index 82409d438413e..3b014fcc47a8b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php @@ -298,7 +298,7 @@ protected static function getFoo_BazService($container) */ protected static function getFooBarService($container) { - $container->factories['foo_bar'] = static function ($container) { + $container->factories['foo_bar'] = function ($container) { return new \Bar\FooClass(($container->services['deprecated_service'] ?? self::getDeprecatedServiceService($container))); }; @@ -332,12 +332,12 @@ protected static function getLazyContextService($container) { $containerRef = $container->ref; - return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 'k1' => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); yield 'k2' => $container; - }, 2), new RewindableGenerator(static function () { + }, 2), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -351,11 +351,11 @@ protected static function getLazyContextIgnoreInvalidRefService($container) { $containerRef = $container->ref; - return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['lazy_context_ignore_invalid_ref'] = new \LazyContext(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo.baz'] ?? self::getFoo_BazService($container)); - }, 1), new RewindableGenerator(static function () { + }, 1), new RewindableGenerator(function () { return new \EmptyIterator(); }, 0)); } @@ -434,7 +434,7 @@ protected static function getTaggedIteratorService($container) { $containerRef = $container->ref; - return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(static function () use ($containerRef) { + return $container->services['tagged_iterator'] = new \Bar(new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); yield 0 => ($container->services['foo'] ?? self::getFooService($container)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index f184f64dca43a..733bb618cf05b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -29,7 +29,7 @@ public function __construct() $this->aliases = []; - $this->privates['service_container'] = static function ($container) { + $this->privates['service_container'] = function ($container) { include_once \dirname(__DIR__, 1).'/includes/HotPath/I1.php'; include_once \dirname(__DIR__, 1).'/includes/HotPath/P1.php'; include_once \dirname(__DIR__, 1).'/includes/HotPath/T1.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php index 4239d82f1e721..eafe779392fa4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_locator.php @@ -74,15 +74,15 @@ protected static function getFooServiceService($container) { $containerRef = $container->ref; - return $container->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['bar' => #[\Closure(name: 'bar_service', class: 'stdClass')] static function () use ($containerRef) { + return $container->services['foo_service'] = new \Symfony\Component\DependencyInjection\ServiceLocator(['bar' => #[\Closure(name: 'bar_service', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['bar_service'] ?? self::getBarServiceService($container)); - }, 'baz' => #[\Closure(name: 'baz_service', class: 'stdClass')] static function () use ($containerRef): \stdClass { + }, 'baz' => #[\Closure(name: 'baz_service', class: 'stdClass')] function () use ($containerRef): \stdClass { $container = $containerRef->get(); return ($container->privates['baz_service'] ??= new \stdClass()); - }, 'nil' => static function () use ($containerRef) { + }, 'nil' => function () use ($containerRef) { $container = $containerRef->get(); return NULL; @@ -128,7 +128,7 @@ protected static function getTranslator1Service($container) { $containerRef = $container->ref; - return $container->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => #[\Closure(name: 'translator.loader_1', class: 'stdClass')] static function () use ($containerRef) { + return $container->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => #[\Closure(name: 'translator.loader_1', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['translator.loader_1'] ??= new \stdClass()); @@ -144,7 +144,7 @@ protected static function getTranslator2Service($container) { $containerRef = $container->ref; - $container->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => #[\Closure(name: 'translator.loader_2', class: 'stdClass')] static function () use ($containerRef) { + $container->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => #[\Closure(name: 'translator.loader_2', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['translator.loader_2'] ??= new \stdClass()); @@ -164,7 +164,7 @@ protected static function getTranslator3Service($container) { $containerRef = $container->ref; - $container->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => #[\Closure(name: 'translator.loader_3', class: 'stdClass')] static function () use ($containerRef) { + $container->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => #[\Closure(name: 'translator.loader_3', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['translator.loader_3'] ??= new \stdClass()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php index 4ce242bb265d8..17318d1ebbc3a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_duplicates.php @@ -21,7 +21,7 @@ class ProjectServiceContainer extends Container public function __construct() { $containerRef = $this->ref = \WeakReference::create($this); - $this->getService = static function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; + $this->getService = function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; $this->services = $this->privates = []; $this->methodMap = [ 'bar' => 'getBarService', @@ -80,7 +80,7 @@ protected static function getBazService($container) */ protected static function getFooService($container) { - $container->factories['service_container']['foo'] = static function ($container) { + $container->factories['service_container']['foo'] = function ($container) { return new \stdClass(); }; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php index 60700526ead94..265d45ca1f92c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php @@ -21,7 +21,7 @@ class Symfony_DI_PhpDumper_Test_Rot13Parameters extends Container public function __construct() { $containerRef = $this->ref = \WeakReference::create($this); - $this->getService = static function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; + $this->getService = function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; $this->parameters = $this->getDefaultParameters(); $this->services = $this->privates = []; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php index d28800abf0540..029c64cdd101d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_service_locator_argument.php @@ -21,7 +21,7 @@ class Symfony_DI_PhpDumper_Service_Locator_Argument extends Container public function __construct() { $containerRef = $this->ref = \WeakReference::create($this); - $this->getService = static function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; + $this->getService = function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; $this->services = $this->privates = []; $this->syntheticIds = [ 'foo5' => true, @@ -107,7 +107,7 @@ protected static function getFoo2Service($container) */ protected static function getFoo3Service($container) { - $container->factories['service_container']['foo3'] = static function ($container) { + $container->factories['service_container']['foo3'] = function ($container) { return new \stdClass(); }; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php index 77ed9e02882a4..6910fe69ef6da 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php @@ -21,7 +21,7 @@ class ProjectServiceContainer extends Container public function __construct() { $containerRef = $this->ref = \WeakReference::create($this); - $this->getService = static function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; + $this->getService = function () use ($containerRef) { return $containerRef->get()->getService(...\func_get_args()); }; $this->services = $this->privates = []; $this->methodMap = [ 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php index 2b1553e6100d7..68535dd312dbb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_uninitialized_ref.php @@ -62,20 +62,20 @@ protected static function getBarService($container) $instance->foo1 = ($container->services['foo1'] ?? null); $instance->foo2 = null; $instance->foo3 = ($container->privates['foo3'] ?? null); - $instance->closures = [#[\Closure(name: 'foo1', class: 'stdClass')] static function () use ($containerRef) { + $instance->closures = [#[\Closure(name: 'foo1', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->services['foo1'] ?? null); - }, #[\Closure(name: 'foo2')] static function () use ($containerRef) { + }, #[\Closure(name: 'foo2')] function () use ($containerRef) { $container = $containerRef->get(); return null; - }, #[\Closure(name: 'foo3', class: 'stdClass')] static function () use ($containerRef) { + }, #[\Closure(name: 'foo3', class: 'stdClass')] function () use ($containerRef) { $container = $containerRef->get(); return ($container->privates['foo3'] ?? null); }]; - $instance->iter = new RewindableGenerator(static function () use ($containerRef) { + $instance->iter = new RewindableGenerator(function () use ($containerRef) { $container = $containerRef->get(); if (isset($container->services['foo1'])) { @@ -87,7 +87,7 @@ protected static function getBarService($container) if (isset($container->privates['foo3'])) { yield 'foo3' => ($container->privates['foo3'] ?? null); } - }, static function () use ($containerRef) { + }, function () use ($containerRef) { $container = $containerRef->get(); return 0 + (int) (isset($container->services['foo1'])) + (int) (false) + (int) (isset($container->privates['foo3']));
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: