diff --git a/src/Finder.php b/src/Finder.php index 646eda8..33c56df 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -138,10 +138,10 @@ public static function rows(iterable $data, callable $filter, bool $preserveKey continue; } - if (! is_numeric($key)) { + if ($preserveKey || ! is_numeric($key)) { $rowKey = $key; } else { - $rowKey = $preserveKey ? $key : $newKey; + $rowKey = $newKey; ++$newKey; }