Update src/Repositories/DatasetsRepository.php

Co-authored-by: Luke Downing <lukeraymonddowning@gmail.com>
This commit is contained in:
Fabio Ivona
2022-09-22 10:56:47 +02:00
committed by GitHub
parent 84b8c389b2
commit cbd4cefc1a

View File

@ -155,7 +155,10 @@ final class DatasetsRepository
return true;
}, ARRAY_FILTER_USE_KEY);
$closestScopeDatasetKey = array_reduce(array_keys($matchingDatasets), function ($keyA, $keyB) {
$closestScopeDatasetKey = array_reduce(
array_keys($matchingDatasets),
fn ($keyA, $keyB) => $keyA !== null && strlen($keyA) > strlen($keyB) ? $keyA : $keyB
);
if ($keyA === null) {
return $keyB;
}