Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated php-etl contract versions #14

Merged
merged 8 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/infection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:

- name: Infection
run: |
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar.asc
wget -q https://github.com/infection/infection/releases/download/0.27.0/infection.phar
wget -q https://github.com/infection/infection/releases/download/0.27.0/infection.phar.asc
chmod +x infection.phar
./infection.phar

Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/phpstan-5.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/phpstan-6.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PHPStan level 6
on: push
jobs:
phpstan:
phpstan-6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan-7.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PHPStan level 7
on: push
jobs:
phpstan:
phpstan-7:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan-8.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PHPStan level 8
on: push
jobs:
phpstan:
phpstan-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Quality (PHPStan level 4)
name: Quality (PHPStan level 5)
on: push
jobs:
cs-fixer:
Expand Down Expand Up @@ -34,6 +34,6 @@ jobs:
uses: php-actions/phpstan@v3
with:
path: src/
level: 4
level: 5
php_version: '8.2'
php_extensions: zip xdebug
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This package brings tools to read and write into spreadsheet files from a pipeli


[![Quality](https://github.com/php-etl/spreadsheet-flow/actions/workflows/quality.yaml/badge.svg)](https://github.com/php-etl/spreadsheet-flow/actions/workflows/quality.yaml)
[![PHPStan level 5](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-5.yaml/badge.svg)](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-5.yaml)
[![PHPStan level 6](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-6.yaml/badge.svg)](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-6.yaml)
[![PHPStan level 7](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-7.yaml/badge.svg)](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-7.yaml)
[![PHPStan level 8](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-8.yaml/badge.svg)](https://github.com/php-etl/spreadsheet-flow/actions/workflows/phpstan-8.yaml)
![PHP](https://img.shields.io/packagist/php-v/php-etl/spreadsheet-flow)
Expand Down
43 changes: 15 additions & 28 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="true"
colors="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Functional tests">
<directory>tests/functional/</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<ini name="allow_url_include" value="1"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" backupGlobals="true" colors="false" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" stopOnRisky="false" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Functional tests">
<directory>tests/functional/</directory>
</testsuite>
</testsuites>
<coverage/>
<php>
<ini name="allow_url_include" value="1"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
3 changes: 1 addition & 2 deletions src/CSV/FingersCrossed/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

readonly class Extractor implements ExtractorInterface

Check failure on line 15 in src/CSV/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 15 in src/CSV/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 15 in src/CSV/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType
{
public function __construct(
private ReaderInterface $reader,
private int $skipLines = 0,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function extract(): iterable
{
Expand Down
24 changes: 17 additions & 7 deletions src/CSV/FingersCrossed/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,50 @@
use Box\Spout\Writer\WriterInterface;
use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Component\Bucket\RejectionResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\FlushableInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

readonly class Loader implements LoaderInterface, FlushableInterface

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/FingersCrossed/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\FingersCrossed\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType
{
public function __construct(
private WriterInterface $writer,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function load(): \Generator
{
$line = yield;
$line = yield new EmptyResultBucket();
try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);

return;
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
}

/* @phpstan-ignore-next-line */
while (true) {
try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), $line), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
sebprt marked this conversation as resolved.
Show resolved Hide resolved
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
continue;
}

$line = yield new AcceptanceResultBucket($line);
Expand Down
3 changes: 1 addition & 2 deletions src/CSV/Safe/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

readonly class Extractor implements ExtractorInterface

Check failure on line 15 in src/CSV/Safe/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 15 in src/CSV/Safe/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 15 in src/CSV/Safe/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType
{
public function __construct(
private ReaderInterface $reader,
private int $skipLines = 0,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function extract(): iterable
{
Expand Down
24 changes: 17 additions & 7 deletions src/CSV/Safe/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,56 @@
use Box\Spout\Writer\WriterInterface;
use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Component\Bucket\RejectionResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\FlushableInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

readonly class Loader implements LoaderInterface, FlushableInterface

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\FlushableInterface but does not specify its types: Type

Check failure on line 21 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader implements generic interface Kiboko\Contract\Pipeline\LoaderInterface but does not specify its types: InputType, OutputType
{
public function __construct(
private WriterInterface $writer,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function load(): \Generator
{
$line = yield;
$line = yield new EmptyResultBucket();
$headers = array_keys($line);
try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);

return;
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
}

/* @phpstan-ignore-next-line */
while (true) {
try {
$this->writer->addRow($this->orderColumns($headers, $line));
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
continue;
}

$line = yield new AcceptanceResultBucket($line);
}
}

private function orderColumns(array $headers, array $line): Row

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $headers with no value type specified in iterable type array.

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $line with no value type specified in iterable type array.

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $headers with no value type specified in iterable type array.

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $line with no value type specified in iterable type array.

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $headers with no value type specified in iterable type array.

Check failure on line 63 in src/CSV/Safe/Loader.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Method Kiboko\Component\Flow\Spreadsheet\CSV\Safe\Loader::orderColumns() has parameter $line with no value type specified in iterable type array.
{
$result = [];
foreach ($headers as $cell) {
Expand Down
3 changes: 1 addition & 2 deletions src/Sheet/FingersCrossed/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

readonly class Extractor implements ExtractorInterface

Check failure on line 17 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Class Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 17 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Class Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType

Check failure on line 17 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Class Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor implements generic interface Kiboko\Contract\Pipeline\ExtractorInterface but does not specify its types: OutputType
{
public function __construct(
private ReaderInterface $reader,
private string $sheetName,
private int $skipLines = 0,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function extract(): iterable
{
Expand Down Expand Up @@ -60,7 +59,7 @@
}
}

public function flush(): ResultBucketInterface

Check failure on line 62 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-6

Method Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor::flush() return type with generic interface Kiboko\Contract\Bucket\ResultBucketInterface does not specify its types: Type

Check failure on line 62 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-8

Method Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor::flush() return type with generic interface Kiboko\Contract\Bucket\ResultBucketInterface does not specify its types: Type

Check failure on line 62 in src/Sheet/FingersCrossed/Extractor.php

View workflow job for this annotation

GitHub Actions / phpstan-7

Method Kiboko\Component\Flow\Spreadsheet\Sheet\FingersCrossed\Extractor::flush() return type with generic interface Kiboko\Contract\Bucket\ResultBucketInterface does not specify its types: Type
{
$this->reader->close();

Expand Down
21 changes: 16 additions & 5 deletions src/Sheet/FingersCrossed/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Box\Spout\Writer\WriterInterface;
use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Component\Bucket\RejectionResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\FlushableInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;
Expand All @@ -30,25 +31,35 @@ public function __construct(

public function load(): \Generator
{
$line = yield;
$line = yield new EmptyResultBucket();

try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
sebprt marked this conversation as resolved.
Show resolved Hide resolved

return;
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
}

/* @phpstan-ignore-next-line */
while (true) {
try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), $line), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
sebprt marked this conversation as resolved.
Show resolved Hide resolved
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
continue;
}

$line = yield new AcceptanceResultBucket($line);
Expand Down
3 changes: 1 addition & 2 deletions src/Sheet/Safe/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
private string $sheetName,
private int $skipLines = 0,
private LoggerInterface $logger = new NullLogger()
) {
}
) {}

public function extract(): iterable
{
Expand Down
21 changes: 16 additions & 5 deletions src/Sheet/Safe/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Box\Spout\Writer\WriterInterface;
use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Component\Bucket\RejectionResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\FlushableInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;
Expand All @@ -30,23 +31,33 @@ public function __construct(

public function load(): \Generator
{
$line = yield;
$line = yield new EmptyResultBucket();
$headers = array_keys($line);
try {
$this->writer->addRow(
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
);
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
sebprt marked this conversation as resolved.
Show resolved Hide resolved

return;
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
}

/* @phpstan-ignore-next-line */
while (true) {
try {
$this->writer->addRow($this->orderColumns($headers, $line));
} catch (WriterNotOpenedException|IOException $exception) {
} catch (IOException|WriterNotOpenedException $exception) {
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
sebprt marked this conversation as resolved.
Show resolved Hide resolved
$line = yield new RejectionResultBucket(
'Impossible to load data to the given CSV file.',
$exception,
$line
);
continue;
}

$line = yield new AcceptanceResultBucket($line);
Expand Down
Loading
Loading