Skip to content

Commit

Permalink
fix: Module Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Feb 6, 2025
1 parent 4602df2 commit b8d4ea7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Module/ModuleFilterLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ public function load(string $configurationFilePath, string $localConfigurationFi
return ModuleFilter::unrestricted();
}

$localConfigurationData = $this->readJsonFile($localConfigurationFilePath);
$localConfigurationData = $this->readJsonFile($localConfigurationFilePath, false);

$mergedConfiguration = array_values(array_unique([...$configurationData->core, ...($localConfigurationData ?? [])]));

return ModuleFilter::restrictedTo($mergedConfiguration);
}

private function readJsonFile(string $filePath): ?object
private function readJsonFile(string $filePath, bool $warnMissingFile = true): ?object
{
$fileContents = @file_get_contents($filePath);
if ($fileContents === false) {
$this->io->warning('No module filter configuration found');
if ($warnMissingFile) {
$this->io->warning('No module filter configuration found');
}

return null;
}
Expand Down

0 comments on commit b8d4ea7

Please sign in to comment.