diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
index 99f1d5af44..5d1e803ab3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php
@@ -32,6 +32,8 @@ class UnusedTagsPass implements CompilerPassInterface
'container.env_var_loader',
'container.env_var_processor',
'container.hot_path',
+ 'container.no_preload',
+ 'container.preload',
'container.reversible',
'container.service_locator',
'container.service_locator_context',
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index df8416100c..ef70dcd008 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -434,7 +434,8 @@ class FrameworkExtension extends Extension
$container->registerForAutoconfiguration(CacheClearerInterface::class)
->addTag('kernel.cache_clearer');
$container->registerForAutoconfiguration(CacheWarmerInterface::class)
- ->addTag('kernel.cache_warmer');
+ ->addTag('kernel.cache_warmer')
+ ->addTag('container.no_preload');
$container->registerForAutoconfiguration(EventSubscriberInterface::class)
->addTag('kernel.event_subscriber');
$container->registerForAutoconfiguration(LocaleAwareInterface::class)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
index 0ce6bf6594..7eac708e83 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml
@@ -34,6 +34,7 @@
+
%kernel.cache_dir%/annotations.php
#^Symfony\\(?:Component\\HttpKernel\\|Bundle\\FrameworkBundle\\Controller\\(?!.*Controller$))#
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml
index d4a7396c60..d5a099d7b2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml
@@ -20,6 +20,7 @@
cache.serializer
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml
index cbd43ac7a6..3ef3108b45 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml
@@ -11,10 +11,12 @@
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml
index 9c9eec1e15..e4105a59f4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml
@@ -101,6 +101,7 @@
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
index 0dbc388ddf..5d7d536dee 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
@@ -107,6 +107,7 @@
%serializer.mapping.cache.file%
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
index d9035ca7b8..0c22d637d5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
@@ -66,6 +66,7 @@
+
%kernel.debug%
%kernel.cache_dir%/%kernel.container_class%Deprecations.log
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
index 3c158abb02..4d056a01a3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
@@ -139,6 +139,7 @@
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
index 070908f3db..01c8b36de8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
@@ -36,6 +36,7 @@
%validator.mapping.cache.file%
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml
index 28dceee7de..7219210597 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml
@@ -222,6 +222,7 @@
+
diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
index ff23962cd3..47603bc4fd 100644
--- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
+++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
@@ -18,6 +18,14 @@
+
+
+
+
+
+
+
+
@@ -37,6 +45,7 @@
+
diff --git a/src/Symfony/Bundle/TwigBundle/TwigBundle.php b/src/Symfony/Bundle/TwigBundle/TwigBundle.php
index 58760b65ae..3910dd5e2e 100644
--- a/src/Symfony/Bundle/TwigBundle/TwigBundle.php
+++ b/src/Symfony/Bundle/TwigBundle/TwigBundle.php
@@ -19,20 +19,6 @@ use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
-use Twig\Cache\FilesystemCache;
-use Twig\Extension\CoreExtension;
-use Twig\Extension\EscaperExtension;
-use Twig\Extension\OptimizerExtension;
-use Twig\Extension\StagingExtension;
-use Twig\ExtensionSet;
-
-// Help opcache.preload discover always-needed symbols
-class_exists(FilesystemCache::class);
-class_exists(CoreExtension::class);
-class_exists(EscaperExtension::class);
-class_exists(OptimizerExtension::class);
-class_exists(StagingExtension::class);
-class_exists(ExtensionSet::class);
/**
* Bundle.
diff --git a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php
index 666c8fa598..f4cd3874c5 100644
--- a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php
+++ b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php
@@ -28,11 +28,13 @@ class AddConsoleCommandPass implements CompilerPassInterface
{
private $commandLoaderServiceId;
private $commandTag;
+ private $noPreloadTag;
- public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command')
+ public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload')
{
$this->commandLoaderServiceId = $commandLoaderServiceId;
$this->commandTag = $commandTag;
+ $this->noPreloadTag = $noPreloadTag;
}
public function process(ContainerBuilder $container)
@@ -44,6 +46,7 @@ class AddConsoleCommandPass implements CompilerPassInterface
foreach ($commandServices as $id => $tags) {
$definition = $container->getDefinition($id);
+ $definition->addTag($this->noPreloadTag);
$class = $container->getParameterBag()->resolveValue($definition->getClass());
if (isset($tags[0]['command'])) {
@@ -91,6 +94,7 @@ class AddConsoleCommandPass implements CompilerPassInterface
$container
->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
->setPublic(true)
+ ->addTag($this->noPreloadTag)
->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
$container->setParameter('console.command.ids', $serviceIds);
diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
index 607e231e72..143ba703b4 100644
--- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md
+++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
@@ -13,6 +13,7 @@ CHANGELOG
* deprecated the `Psr\Container\ContainerInterface` and `Symfony\Component\DependencyInjection\ContainerInterface` aliases of the `service_container` service,
configure them explicitly instead
* added class `Symfony\Component\DependencyInjection\Dumper\Preloader` to help with preloading on PHP 7.4+
+ * added tags `container.preload`/`.no_preload` to declare extra classes to preload/services to not preload
5.0.0
-----
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 3ee7eba38a..3e38c0a91f 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -78,6 +78,7 @@ class PhpDumper extends Dumper
private $namespace;
private $asFiles;
private $hotPathTag;
+ private $preloadTags;
private $inlineFactories;
private $inlineRequires;
private $inlinedRequires = [];
@@ -143,6 +144,7 @@ class PhpDumper extends Dumper
'as_files' => false,
'debug' => true,
'hot_path_tag' => 'container.hot_path',
+ 'preload_tags' => ['container.preload', 'container.no_preload'],
'inline_factories_parameter' => 'container.dumper.inline_factories',
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
'preload_classes' => [],
@@ -154,6 +156,7 @@ class PhpDumper extends Dumper
$this->namespace = $options['namespace'];
$this->asFiles = $options['as_files'];
$this->hotPathTag = $options['hot_path_tag'];
+ $this->preloadTags = $options['preload_tags'];
$this->inlineFactories = $this->asFiles && $options['inline_factories_parameter'] && (!$this->container->hasParameter($options['inline_factories_parameter']) || $this->container->getParameter($options['inline_factories_parameter']));
$this->inlineRequires = $options['inline_class_loader_parameter'] && ($this->container->hasParameter($options['inline_class_loader_parameter']) ? $this->container->getParameter($options['inline_class_loader_parameter']) : (\PHP_VERSION_ID < 70400 || $options['debug']));
$this->serviceLocatorTag = $options['service_locator_tag'];
@@ -571,7 +574,7 @@ EOF;
$lineage = [];
foreach ($this->inlinedDefinitions as $def) {
if (!$def->isDeprecated()) {
- foreach ($this->getClasses($def) as $class) {
+ foreach ($this->getClasses($def, $cId) as $class) {
$this->collectLineage($class, $lineage);
}
}
@@ -583,7 +586,7 @@ EOF;
&& $this->container->has($id)
&& $this->isTrivialInstance($def = $this->container->findDefinition($id))
) {
- foreach ($this->getClasses($def) as $class) {
+ foreach ($this->getClasses($def, $cId) as $class) {
$this->collectLineage($class, $lineage);
}
}
@@ -838,9 +841,9 @@ EOF;
if ($definition->isDeprecated()) {
$deprecation = $definition->getDeprecation($id);
$code .= sprintf(" trigger_deprecation(%s, %s, %s);\n\n", $this->export($deprecation['package']), $this->export($deprecation['version']), $this->export($deprecation['message']));
- } else {
+ } elseif (!$definition->hasTag($this->preloadTags[1])) {
foreach ($this->inlinedDefinitions as $def) {
- foreach ($this->getClasses($def) as $class) {
+ foreach ($this->getClasses($def, $id) as $class) {
$this->preload[$class] = $class;
}
}
@@ -1003,10 +1006,10 @@ EOTXT
foreach ($definitions as $id => $definition) {
if (!$definition->isSynthetic()) {
$services[$id] = $this->addService($id, $definition);
- } else {
+ } elseif (!$definition->hasTag($this->preloadTags[1])) {
$services[$id] = null;
- foreach ($this->getClasses($definition) as $class) {
+ foreach ($this->getClasses($definition, $id) as $class) {
$this->preload[$class] = $class;
}
}
@@ -1385,7 +1388,7 @@ EOF;
$inlinedDefinitions = $this->getDefinitionsFromArguments([$definition]);
foreach ($inlinedDefinitions as $def) {
- foreach ($this->getClasses($def) as $class) {
+ foreach ($this->getClasses($def, $id) as $class) {
$this->collectLineage($class, $lineage);
}
}
@@ -2112,11 +2115,19 @@ EOF;
return null;
}
- private function getClasses(Definition $definition): array
+ private function getClasses(Definition $definition, string $id): array
{
$classes = [];
while ($definition instanceof Definition) {
+ foreach ($definition->getTag($this->preloadTags[0]) as $tag) {
+ if (!isset($tag['class'])) {
+ throw new InvalidArgumentException(sprintf('Missing attribute "class" on tag "%s" for service "%s".', $this->preloadTags[0], $id));
+ }
+
+ $classes[] = trim($tag['class'], '\\');
+ }
+
$classes[] = trim($definition->getClass(), '\\');
$factory = $definition->getFactory();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php
index 0f669b3740..1ae8a7311a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php
@@ -134,6 +134,10 @@ return function (ContainerConfigurator $c) {
->args([new Reference('errored_definition', ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE)])
->public();
$s->set('errored_definition', 'stdClass')->private();
+ $s->set('preload_sidekick', 'stdClass')
+ ->tag('container.preload', ['class' => 'Some\Sidekick1'])
+ ->tag('container.preload', ['class' => 'Some\Sidekick2'])
+ ->public();
$s->alias('alias_for_foo', 'foo')->private()->public();
$s->alias('alias_for_alias', ref('alias_for_foo'));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
index d984f20e56..7f9d8db80b 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
@@ -187,4 +187,9 @@ $container->register('runtime_error', 'stdClass')
$container->register('errored_definition', 'stdClass')
->addError('Service "errored_definition" is broken.');
+$container->register('preload_sidekick', 'stdClass')
+ ->setPublic(true)
+ ->addTag('container.preload', ['class' => 'Some\Sidekick1'])
+ ->addTag('container.preload', ['class' => 'Some\Sidekick2']);
+
return $container;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
index 5cf170fddb..994506f25a 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot
@@ -36,6 +36,7 @@ digraph sc {
node_tagged_iterator [label="tagged_iterator\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_runtime_error [label="runtime_error\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_errored_definition [label="errored_definition\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
+ node_preload_sidekick [label="preload_sidekick\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"];
node_foo2 [label="foo2\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foo3 [label="foo3\n\n", shape=record, fillcolor="#ff9999", style="filled"];
node_foobaz [label="foobaz\n\n", shape=record, fillcolor="#ff9999", style="filled"];
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 051cc6438e..46270abd36 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
@@ -578,6 +578,29 @@ class getNonSharedFooService extends ProjectServiceContainer
}
}
+ [Container%s/getPreloadSidekickService.php] => services['preload_sidekick'] = new \stdClass();
+ }
+}
+
[Container%s/getRuntimeErrorService.php] => 'getMethodCall1Service',
'new_factory_service' => 'getNewFactoryServiceService',
'non_shared_foo' => 'getNonSharedFooService',
+ 'preload_sidekick' => 'getPreloadSidekickService',
'runtime_error' => 'getRuntimeErrorService',
'service_from_static_method' => 'getServiceFromStaticMethodService',
'tagged_iterator' => 'getTaggedIteratorService',
@@ -873,6 +897,7 @@ require __DIR__.'/Container%s/getThrowingOneService.php';
require __DIR__.'/Container%s/getTaggedIteratorService.php';
require __DIR__.'/Container%s/getServiceFromStaticMethodService.php';
require __DIR__.'/Container%s/getRuntimeErrorService.php';
+require __DIR__.'/Container%s/getPreloadSidekickService.php';
require __DIR__.'/Container%s/getNonSharedFooService.php';
require __DIR__.'/Container%s/getNewFactoryServiceService.php';
require __DIR__.'/Container%s/getMethodCall1Service.php';
@@ -906,6 +931,8 @@ $classes[] = 'Foo';
$classes[] = 'LazyContext';
$classes[] = 'FooBarBaz';
$classes[] = 'FactoryClass';
+$classes[] = 'Some\Sidekick1';
+$classes[] = 'Some\Sidekick2';
$classes[] = 'Request';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
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 3ba0060dc2..277da470b5 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@@ -45,6 +45,7 @@ class ProjectServiceContainer extends Container
'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService',
'method_call1' => 'getMethodCall1Service',
'new_factory_service' => 'getNewFactoryServiceService',
+ 'preload_sidekick' => 'getPreloadSidekickService',
'runtime_error' => 'getRuntimeErrorService',
'service_from_static_method' => 'getServiceFromStaticMethodService',
'tagged_iterator' => 'getTaggedIteratorService',
@@ -359,6 +360,16 @@ class ProjectServiceContainer extends Container
return $instance;
}
+ /**
+ * Gets the public 'preload_sidekick' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getPreloadSidekickService()
+ {
+ return $this->services['preload_sidekick'] = new \stdClass();
+ }
+
/**
* Gets the public 'runtime_error' shared service.
*
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 7fec9d4dda..56179d07d2 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
@@ -75,6 +75,7 @@ class ProjectServiceContainer extends Container
'method_call1' => 'getMethodCall1Service',
'new_factory_service' => 'getNewFactoryServiceService',
'non_shared_foo' => 'getNonSharedFooService',
+ 'preload_sidekick' => 'getPreloadSidekickService',
'runtime_error' => 'getRuntimeErrorService',
'service_from_static_method' => 'getServiceFromStaticMethodService',
'tagged_iterator' => 'getTaggedIteratorService',
@@ -400,6 +401,16 @@ class ProjectServiceContainer extends Container
return new \Bar\FooClass();
}
+ /**
+ * Gets the public 'preload_sidekick' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getPreloadSidekickService()
+ {
+ return $this->services['preload_sidekick'] = new \stdClass();
+ }
+
/**
* Gets the public 'runtime_error' shared service.
*
@@ -549,6 +560,8 @@ $classes[] = 'Foo';
$classes[] = 'LazyContext';
$classes[] = 'FooBarBaz';
$classes[] = 'FactoryClass';
+$classes[] = 'Some\Sidekick1';
+$classes[] = 'Some\Sidekick2';
$classes[] = 'Request';
$classes[] = 'Symfony\Component\DependencyInjection\ContainerInterface';
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 11ed6f9d47..9f2bb02158 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
@@ -45,6 +45,7 @@ class Symfony_DI_PhpDumper_Errored_Definition extends Container
'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService',
'method_call1' => 'getMethodCall1Service',
'new_factory_service' => 'getNewFactoryServiceService',
+ 'preload_sidekick' => 'getPreloadSidekickService',
'runtime_error' => 'getRuntimeErrorService',
'service_from_static_method' => 'getServiceFromStaticMethodService',
'tagged_iterator' => 'getTaggedIteratorService',
@@ -359,6 +360,16 @@ class Symfony_DI_PhpDumper_Errored_Definition extends Container
return $instance;
}
+ /**
+ * Gets the public 'preload_sidekick' shared service.
+ *
+ * @return \stdClass
+ */
+ protected function getPreloadSidekickService()
+ {
+ return $this->services['preload_sidekick'] = new \stdClass();
+ }
+
/**
* Gets the public 'runtime_error' shared service.
*
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
index 3281f24d70..eafb839f6d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml
@@ -148,6 +148,10 @@
+
+
+
+
The "%alias_id%" autowiring alias is deprecated. Define it explicitly in your app if you want to keep using it.
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
index 88d271132a..0f6164d9ad 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
@@ -191,3 +191,9 @@ services:
public: true
errored_definition:
class: stdClass
+ preload_sidekick:
+ class: stdClass
+ tags:
+ - {name: container.preload, class: 'Some\Sidekick1'}
+ - {name: container.preload, class: 'Some\Sidekick2'}
+ public: true
diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
index e9e36e9f64..b2e58a0803 100644
--- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
+++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
@@ -14,6 +14,9 @@ namespace Symfony\Component\ExpressionLanguage;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
+// Help opcache.preload discover always-needed symbols
+class_exists(ParsedExpression::class);
+
/**
* Allows to compile and evaluate expressions written in your own DSL.
*
diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php
index 24910f0827..cefd5026bb 100644
--- a/src/Symfony/Component/Translation/Translator.php
+++ b/src/Symfony/Component/Translation/Translator.php
@@ -24,6 +24,9 @@ use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Contracts\Translation\LocaleAwareInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
+// Help opcache.preload discover always-needed symbols
+class_exists(MessageCatalogue::class);
+
/**
* @author Fabien Potencier
*/