Skip to content

Commit c950a43

Browse files
[DI] fix preloading script generation
1 parent 07ad590 commit c950a43

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

FrameworkBundle.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerWeakRefPass;
2424
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
2525
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\WorkflowGuardListenerPass;
26+
use Symfony\Component\Cache\Adapter\ApcuAdapter;
27+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
28+
use Symfony\Component\Cache\Adapter\ChainAdapter;
29+
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
30+
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
2631
use Symfony\Component\Cache\DependencyInjection\CacheCollectorPass;
2732
use Symfony\Component\Cache\DependencyInjection\CachePoolClearerPass;
2833
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
@@ -32,6 +37,7 @@
3237
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
3338
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
3439
use Symfony\Component\DependencyInjection\ContainerBuilder;
40+
use Symfony\Component\Dotenv\Dotenv;
3541
use Symfony\Component\ErrorHandler\ErrorHandler;
3642
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
3743
use Symfony\Component\Form\DependencyInjection\FormPass;
@@ -58,6 +64,19 @@
5864
use Symfony\Component\Validator\DependencyInjection\AddAutoMappingConfigurationPass;
5965
use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
6066
use Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass;
67+
use Symfony\Component\VarExporter\Internal\Hydrator;
68+
use Symfony\Component\VarExporter\Internal\Registry;
69+
70+
// Help opcache.preload discover always-needed symbols
71+
class_exists(ApcuAdapter::class);
72+
class_exists(ArrayAdapter::class);
73+
class_exists(ChainAdapter::class);
74+
class_exists(PhpArrayAdapter::class);
75+
class_exists(PhpFilesAdapter::class);
76+
class_exists(Dotenv::class);
77+
class_exists(ErrorHandler::class);
78+
class_exists(Hydrator::class);
79+
class_exists(Registry::class);
6180

6281
/**
6382
* Bundle.

Routing/Router.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@
2020
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
2121
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2222
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
23+
use Symfony\Component\Routing\Annotation\Route;
2324
use Symfony\Component\Routing\RequestContext;
2425
use Symfony\Component\Routing\RouteCollection;
2526
use Symfony\Component\Routing\Router as BaseRouter;
2627

28+
// Help opcache.preload discover always-needed symbols
29+
class_exists(RedirectableCompiledUrlMatcher::class);
30+
class_exists(Route::class);
31+
2732
/**
2833
* This Router creates the Loader only when the cache is empty.
2934
*

0 commit comments

Comments
 (0)