Skip to content

Commit 9a70f6d

Browse files
authored
Merge pull request #14 from php-etl/feature/update-contracts
Updated php-etl contract versions
2 parents 5002f3b + 0b75422 commit 9a70f6d

File tree

17 files changed

+99
-105
lines changed

17 files changed

+99
-105
lines changed

.github/workflows/infection.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323

2424
- name: Infection
2525
run: |
26-
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar
27-
wget -q https://github.com/infection/infection/releases/download/0.26.18/infection.phar.asc
26+
wget -q https://github.com/infection/infection/releases/download/0.27.0/infection.phar
27+
wget -q https://github.com/infection/infection/releases/download/0.27.0/infection.phar.asc
2828
chmod +x infection.phar
2929
./infection.phar
3030

.github/workflows/phpstan-5.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/phpstan-6.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PHPStan level 6
22
on: push
33
jobs:
4-
phpstan:
4+
phpstan-6:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3

.github/workflows/phpstan-7.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PHPStan level 7
22
on: push
33
jobs:
4-
phpstan:
4+
phpstan-7:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3

.github/workflows/phpstan-8.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PHPStan level 8
22
on: push
33
jobs:
4-
phpstan:
4+
phpstan-8:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3

.github/workflows/quality.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Quality (PHPStan level 4)
1+
name: Quality (PHPStan level 5)
22
on: push
33
jobs:
44
cs-fixer:
@@ -34,6 +34,6 @@ jobs:
3434
uses: php-actions/phpstan@v3
3535
with:
3636
path: src/
37-
level: 4
37+
level: 5
3838
php_version: '8.2'
3939
php_extensions: zip xdebug

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This package brings tools to read and write into spreadsheet files from a pipeli
55

66

77
[![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)
8-
[![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)
8+
[![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)
99
[![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)
1010
[![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)
1111
![PHP](https://img.shields.io/packagist/php-v/php-etl/spreadsheet-flow)

phpunit.xml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
4-
backupGlobals="true"
5-
colors="false"
6-
processIsolation="false"
7-
stopOnError="false"
8-
stopOnFailure="false"
9-
stopOnIncomplete="false"
10-
stopOnSkipped="false"
11-
stopOnRisky="false"
12-
timeoutForSmallTests="1"
13-
timeoutForMediumTests="10"
14-
timeoutForLargeTests="60"
15-
cacheDirectory=".phpunit.cache"
16-
>
17-
<testsuites>
18-
<testsuite name="Functional tests">
19-
<directory>tests/functional/</directory>
20-
</testsuite>
21-
</testsuites>
22-
<coverage>
23-
<include>
24-
<directory suffix=".php">src</directory>
25-
</include>
26-
</coverage>
27-
<php>
28-
<ini name="allow_url_include" value="1"/>
29-
</php>
2+
<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">
3+
<testsuites>
4+
<testsuite name="Functional tests">
5+
<directory>tests/functional/</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage/>
9+
<php>
10+
<ini name="allow_url_include" value="1"/>
11+
</php>
12+
<source>
13+
<include>
14+
<directory suffix=".php">src</directory>
15+
</include>
16+
</source>
3017
</phpunit>

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: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Box\Spout\Writer\WriterInterface;
1212
use Kiboko\Component\Bucket\AcceptanceResultBucket;
1313
use Kiboko\Component\Bucket\EmptyResultBucket;
14+
use Kiboko\Component\Bucket\RejectionResultBucket;
1415
use Kiboko\Contract\Bucket\ResultBucketInterface;
1516
use Kiboko\Contract\Pipeline\FlushableInterface;
1617
use Kiboko\Contract\Pipeline\LoaderInterface;
@@ -22,29 +23,38 @@
2223
public function __construct(
2324
private WriterInterface $writer,
2425
private LoggerInterface $logger = new NullLogger()
25-
) {
26-
}
26+
) {}
2727

2828
public function load(): \Generator
2929
{
30-
$line = yield;
30+
$line = yield new EmptyResultBucket();
3131
try {
3232
$this->writer->addRow(
3333
new Row(array_map(fn ($value) => new Cell($value), array_keys($line)), null)
3434
);
35-
} catch (WriterNotOpenedException|IOException $exception) {
35+
} catch (IOException|WriterNotOpenedException $exception) {
3636
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
37-
38-
return;
37+
$line = yield new RejectionResultBucket(
38+
'Impossible to load data to the given CSV file.',
39+
$exception,
40+
$line
41+
);
3942
}
4043

44+
/* @phpstan-ignore-next-line */
4145
while (true) {
4246
try {
4347
$this->writer->addRow(
4448
new Row(array_map(fn ($value) => new Cell($value), $line), null)
4549
);
46-
} catch (WriterNotOpenedException|IOException $exception) {
50+
} catch (IOException|WriterNotOpenedException $exception) {
4751
$this->logger->error('Impossible to load data to the given CSV file.', ['line' => $line, 'message' => $exception->getMessage(), 'previous' => $exception->getPrevious()]);
52+
$line = yield new RejectionResultBucket(
53+
'Impossible to load data to the given CSV file.',
54+
$exception,
55+
$line
56+
);
57+
continue;
4858
}
4959

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

0 commit comments

Comments
 (0)