Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3409955

Browse files
[FrameworkBundle] Added flex-based default implementation for MicroKernelTrait::registerBundles()
1 parent 24ed8e1 commit 3409955

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Marked `MicroKernelTrait::configureRoutes()` as `@internal` and `@final`.
88
* Deprecated not overriding `MicroKernelTrait::configureRouting()`.
99
* Added a new `mailer.message_bus` option to configure or disable the message bus to use to send mails.
10+
* Added flex-based default implementation for `MicroKernelTrait::registerBundles()`
1011

1112
5.0.0
1213
-----

src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ protected function configureRouting(RoutingConfigurator $routes): void
7272
*/
7373
abstract protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader);
7474

75+
/**
76+
* {@inheritdoc}
77+
*/
78+
public function registerBundles(): iterable
79+
{
80+
$contents = require $this->getProjectDir().'/config/bundles.php';
81+
foreach ($contents as $class => $envs) {
82+
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
83+
yield new $class();
84+
}
85+
}
86+
}
87+
7588
/**
7689
* {@inheritdoc}
7790
*/
@@ -99,6 +112,10 @@ public function registerContainerConfiguration(LoaderInterface $loader)
99112
$kernelDefinition->addTag('kernel.event_subscriber');
100113
}
101114

115+
$container->fileExists($this->getProjectDir().'/config/bundles.php');
116+
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || !ini_get('opcache.preload'));
117+
$container->setParameter('container.dumper.inline_factories', true);
118+
102119
$this->configureContainer($container, $loader);
103120

104121
$container->addObjectResource($this);

0 commit comments

Comments
 (0)