diff --git a/src/Application/CsvParser.php b/src/Application/CsvParser.php index 17a7a110..1398c16c 100644 --- a/src/Application/CsvParser.php +++ b/src/Application/CsvParser.php @@ -4,6 +4,7 @@ namespace kissj\Application; +use Iterator; use League\Csv\Exception as LeagueCsvException; use League\Csv\Reader; use Psr\Http\Message\StreamInterface; @@ -15,9 +16,8 @@ class CsvParser /** * @throws UnexpectedValueException * @throws LeagueCsvException - * @return array> */ - public function parseCsv(UploadedFile $file): array + public function parseCsv(UploadedFile $file): Iterator { /** @var StreamInterface|null $stream */ $stream = $file->getStream(); @@ -28,9 +28,6 @@ public function parseCsv(UploadedFile $file): array $csv = Reader::createFromString($stream->getContents()); $csv->setHeaderOffset(0); - /** @var array> $records */ - $records = $csv->getRecords(); - - return $records; + return $csv->getRecords(); } } diff --git a/src/Import/ImportSrs.php b/src/Import/ImportSrs.php index ecb82359..c6bbe817 100644 --- a/src/Import/ImportSrs.php +++ b/src/Import/ImportSrs.php @@ -38,6 +38,7 @@ public function importIst(UploadedFile $istsDataFile, Event $event): void { $istsData = []; try { + /** @var array> $istsData */ $istsData = $this->csvParser->parseCsv($istsDataFile); } catch (\UnexpectedValueException | LeagueCsvException) { $this->flashMessages->error($this->translator->trans('flash.error.importSrs.invalidCsv'));