This commit is contained in:
team 1
2026-05-06 17:44:07 +02:00
parent 2b9dcc6e5c
commit 8a2f4f3c67
5 changed files with 280 additions and 1 deletions

View File

@@ -1179,6 +1179,18 @@ final readonly class RetriexEffectiveConfigProvider
}
}
foreach ($this->collectGenreConfigurationValueSourcePaths($configurationValues) as $valuePath => $sourcePaths) {
foreach ($sourcePaths as $sourcePath) {
if (!isset($flattened[$sourcePath])) {
$warnings[] = sprintf(
'genre.configuration_values.%s references unknown source path: %s.',
$valuePath,
$sourcePath
);
}
}
}
foreach (array_keys($surface) as $group) {
if (!is_string($group) || $group === '') {
continue;
@@ -1190,6 +1202,54 @@ final readonly class RetriexEffectiveConfigProvider
}
}
/**
* @param array<string, mixed> $configurationValues
* @return array<string, string[]>
*/
private function collectGenreConfigurationValueSourcePaths(array $configurationValues): array
{
$out = [];
$this->collectGenreSourcePathsRecursive($configurationValues, '', $out);
return $out;
}
/**
* @param array<int|string, mixed> $value
* @param array<string, string[]> $out
*/
private function collectGenreSourcePathsRecursive(array $value, string $path, array &$out): void
{
$sourcePaths = $value['source_paths'] ?? null;
if (is_array($sourcePaths)) {
$clean = [];
foreach ($sourcePaths as $sourcePath) {
if (!is_string($sourcePath) || trim($sourcePath) === '') {
continue;
}
$sourcePath = trim($sourcePath);
if (!in_array($sourcePath, $clean, true)) {
$clean[] = $sourcePath;
}
}
if ($clean !== [] && $path !== '') {
$out[$path] = $clean;
}
}
foreach ($value as $key => $child) {
if ($key === 'source_paths' || !is_string($key) || !is_array($child)) {
continue;
}
$childPath = $path === '' ? $key : $path . '.' . $key;
$this->collectGenreSourcePathsRecursive($child, $childPath, $out);
}
}
/**
* @param array<string, true> $paths
*/