Skip to content

Commit 0fd8413

Browse files
committed
bug symfony#40859 [Config] Support extensions without configuration in ConfigBuilder warmup (wouterj)
This PR was merged into the 5.3-dev branch. Discussion ---------- [Config] Support extensions without configuration in ConfigBuilder warmup | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - `ConfigurationExtensionInterface::getConfiguration()` is nullable. As a real use-case: A small internal bundle in my company just uses `array_merge` to manage a very limited set of configuration. We don't have these fancy Configuration classes. Commits ------- 0a6f5e5 [Config] Support extensions without configuration
2 parents f9ad1cd + 0a6f5e5 commit 0fd8413

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,19 @@ public function warmUp(string $cacheDir)
6969

7070
private function dumpExtension(ExtensionInterface $extension, ConfigBuilderGeneratorInterface $generator): void
7171
{
72+
$configuration = null;
7273
if ($extension instanceof ConfigurationInterface) {
7374
$configuration = $extension;
7475
} elseif ($extension instanceof ConfigurationExtensionInterface) {
7576
$configuration = $extension->getConfiguration([], $this->getContainerBuilder($this->kernel));
76-
} else {
77-
throw new \LogicException(sprintf('Could not get configuration for extension "%s".', \get_class($extension)));
77+
}
78+
79+
if (!$configuration) {
80+
if ($this->logger) {
81+
$this->logger->info('No configuration found for extension {extensionClass}.', ['extensionClass' => \get_class($extension)]);
82+
}
83+
84+
return;
7885
}
7986

8087
$generator->build($configuration);

0 commit comments

Comments
 (0)