Skip to content

Commit 6547682

Browse files
authored
Added error handling for loading config files from installed packages (#262)
[TASK] Throw Exception if config files from installed packages cannot be loaded
1 parent 5527f57 commit 6547682

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/fractor/src/DependencyInjection/ContainerContainerBuilder.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace a9f\Fractor\DependencyInjection;
66

7+
use a9f\Fractor\Exception\ShouldNotHappenException;
78
use a9f\FractorExtensionInstaller\Generated\InstalledPackages;
89
use Symfony\Component\Config\FileLocator;
910
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
@@ -60,7 +61,16 @@ private function collectConfigFilesFromExtensions(): array
6061
}
6162

6263
foreach (InstalledPackages::PACKAGES as $package) {
63-
$collectedConfigFiles[] = $package['path'] . '/config/application.php';
64+
$configPath = $package['path'] . '/config/application.php';
65+
66+
if (! is_readable($configPath)) {
67+
throw new ShouldNotHappenException(sprintf(
68+
'Config file "%s" is not readable or does not exist.',
69+
$configPath
70+
));
71+
}
72+
73+
$collectedConfigFiles[] = $configPath;
6474
}
6575

6676
return $collectedConfigFiles;

0 commit comments

Comments
 (0)