diff --git a/src/Exporter.php b/src/Exporter.php index 3fc4421..9b32f07 100644 --- a/src/Exporter.php +++ b/src/Exporter.php @@ -71,11 +71,13 @@ final readonly class Exporter /* @noinspection UnusedFunctionResultInspection */ $processed->add($data); - $i = 0; + $i = 0; $count = count($data, COUNT_RECURSIVE); + foreach ($array as $key => $value) { if ($count > self::MAX_SHORTENED_ITEMS && $i > self::MAX_SHORTENED_ITEMS) { $result[] = sprintf('...%d more elements', $count - 10); + break; } diff --git a/tests/ExporterTest.php b/tests/ExporterTest.php index 6472d67..157356f 100644 --- a/tests/ExporterTest.php +++ b/tests/ExporterTest.php @@ -322,6 +322,7 @@ EOF, public static function shortenedRecursiveExportProvider(): array { $bigArray = []; + for ($i = 0; $i < 20_000; $i++) { $bigArray[] = 'cast(\'foo' . $i . '\' as blob)'; }