Skip to content

Commit 8caab8a

Browse files
committed
Updated the pipeline runner used for tests
1 parent 5002f3b commit 8caab8a

File tree

9 files changed

+20
-31
lines changed

9 files changed

+20
-31
lines changed

src/CSV/FingersCrossed/Extractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public function __construct(
1818
private ReaderInterface $reader,
1919
private int $skipLines = 0,
2020
private LoggerInterface $logger = new NullLogger()
21-
) {
22-
}
21+
) {}
2322

2423
public function extract(): iterable
2524
{

src/CSV/FingersCrossed/Loader.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
public function __construct(
2323
private WriterInterface $writer,
2424
private LoggerInterface $logger = new NullLogger()
25-
) {
26-
}
25+
) {}
2726

2827
public function load(): \Generator
2928
{
@@ -32,7 +31,7 @@ public function load(): \Generator
3231
$this->writer->addRow(
3332
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
3433
);
35-
} catch (WriterNotOpenedException|IOException $exception) {
34+
} catch (IOException|WriterNotOpenedException $exception) {
3635
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
3736

3837
return;
@@ -43,7 +42,7 @@ public function load(): \Generator
4342
$this->writer->addRow(
4443
new Row(array_map(fn ($value) => new Cell($value), $line), null)
4544
);
46-
} catch (WriterNotOpenedException|IOException $exception) {
45+
} catch (IOException|WriterNotOpenedException $exception) {
4746
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
4847
}
4948

src/CSV/Safe/Extractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public function __construct(
1818
private ReaderInterface $reader,
1919
private int $skipLines = 0,
2020
private LoggerInterface $logger = new NullLogger()
21-
) {
22-
}
21+
) {}
2322

2423
public function extract(): iterable
2524
{

src/CSV/Safe/Loader.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
public function __construct(
2323
private WriterInterface $writer,
2424
private LoggerInterface $logger = new NullLogger()
25-
) {
26-
}
25+
) {}
2726

2827
public function load(): \Generator
2928
{
@@ -33,7 +32,7 @@ public function load(): \Generator
3332
$this->writer->addRow(
3433
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
3534
);
36-
} catch (WriterNotOpenedException|IOException $exception) {
35+
} catch (IOException|WriterNotOpenedException $exception) {
3736
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
3837

3938
return;
@@ -42,7 +41,7 @@ public function load(): \Generator
4241
while (true) {
4342
try {
4443
$this->writer->addRow($this->orderColumns($headers, $line));
45-
} catch (WriterNotOpenedException|IOException $exception) {
44+
} catch (IOException|WriterNotOpenedException $exception) {
4645
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
4746
}
4847

src/Sheet/FingersCrossed/Extractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public function __construct(
2121
private string $sheetName,
2222
private int $skipLines = 0,
2323
private LoggerInterface $logger = new NullLogger()
24-
) {
25-
}
24+
) {}
2625

2726
public function extract(): iterable
2827
{

src/Sheet/FingersCrossed/Loader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function load(): \Generator
3636
$this->writer->addRow(
3737
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
3838
);
39-
} catch (WriterNotOpenedException|IOException $exception) {
39+
} catch (IOException|WriterNotOpenedException $exception) {
4040
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
4141

4242
return;
@@ -47,7 +47,7 @@ public function load(): \Generator
4747
$this->writer->addRow(
4848
new Row(array_map(fn ($value) => new Cell($value), $line), null)
4949
);
50-
} catch (WriterNotOpenedException|IOException $exception) {
50+
} catch (IOException|WriterNotOpenedException $exception) {
5151
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
5252
}
5353

src/Sheet/Safe/Extractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public function __construct(
2121
private string $sheetName,
2222
private int $skipLines = 0,
2323
private LoggerInterface $logger = new NullLogger()
24-
) {
25-
}
24+
) {}
2625

2726
public function extract(): iterable
2827
{

src/Sheet/Safe/Loader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function load(): \Generator
3636
$this->writer->addRow(
3737
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
3838
);
39-
} catch (WriterNotOpenedException|IOException $exception) {
39+
} catch (IOException|WriterNotOpenedException $exception) {
4040
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
4141

4242
return;
@@ -45,7 +45,7 @@ public function load(): \Generator
4545
while (true) {
4646
try {
4747
$this->writer->addRow($this->orderColumns($headers, $line));
48-
} catch (WriterNotOpenedException|IOException $exception) {
48+
} catch (IOException|WriterNotOpenedException $exception) {
4949
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
5050
}
5151

tests/functional/PipelineRunner.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@
77
use Kiboko\Contract\Bucket\AcceptanceResultBucketInterface;
88
use Kiboko\Contract\Bucket\RejectionResultBucketInterface;
99
use Kiboko\Contract\Pipeline\PipelineRunnerInterface;
10-
use Kiboko\Contract\Pipeline\RejectionInterface;
11-
use Kiboko\Contract\Pipeline\StateInterface;
10+
use Kiboko\Contract\Pipeline\StepRejectionInterface;
11+
use Kiboko\Contract\Pipeline\StepStateInterface;
1212

1313
final class PipelineRunner implements PipelineRunnerInterface
1414
{
1515
public function run(
1616
\Iterator $source,
1717
\Generator $async,
18-
RejectionInterface $rejection,
19-
StateInterface $state,
20-
): \Iterator {
21-
$state->initialize();
22-
$rejection->initialize();
23-
18+
StepRejectionInterface $rejection,
19+
StepStateInterface $state,
20+
): \Iterator
21+
{
2422
$source->rewind();
2523
$async->rewind();
2624

@@ -40,8 +38,5 @@ public function run(
4038

4139
$source->next();
4240
}
43-
44-
$rejection->teardown();
45-
$state->teardown();
4641
}
4742
}

0 commit comments

Comments
 (0)