diff --git a/src/SimpleItemsStorage.php b/src/SimpleItemsStorage.php index 9e22322e..565167b6 100644 --- a/src/SimpleItemsStorage.php +++ b/src/SimpleItemsStorage.php @@ -339,11 +339,11 @@ private function getAllChildrenInternal(string|array $names, array &$result): vo * @psalm-param ItemsIndexedByName $result * @psalm-param-out ItemsIndexedByName $result */ - private function fillChildrenRecursive(string $name, array &$result, array $names): void + private function fillChildrenRecursive(string $name, array &$result, array $startNames): void { $children = $this->children[$name] ?? []; foreach ($children as $childName => $_childItem) { - if (in_array($childName, $names, strict: true)) { + if (in_array($childName, $startNames, strict: true)) { continue; } @@ -353,7 +353,7 @@ private function fillChildrenRecursive(string $name, array &$result, array $name $result[$childName] = $child; } - $this->fillChildrenRecursive($childName, $result, $names); + $this->fillChildrenRecursive($childName, $result, $startNames); } }