From a18b984e904370e14744a17aba5c501c6cf14b2b Mon Sep 17 00:00:00 2001 From: sebprt Date: Fri, 20 Oct 2023 15:53:23 +0200 Subject: [PATCH 01/10] Added a way to add rejection reason --- src/PipelineRunner.php | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index a61dbbf..cf91107 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -4,6 +4,8 @@ namespace Kiboko\Component\Pipeline; +use Kiboko\Component\Bucket\RejectionResultBucket; +use Kiboko\Component\Bucket\RejectionWithReasonResultBucket; use Kiboko\Contract\Bucket\AcceptanceResultBucketInterface; use Kiboko\Contract\Bucket\RejectionResultBucketInterface; use Kiboko\Contract\Bucket\ResultBucketInterface; @@ -44,17 +46,34 @@ public function run( } if ($bucket instanceof RejectionResultBucketInterface) { - foreach ($bucket->walkRejection() as $line) { - $rejection->reject($line); - $state->reject(); - - $this->logger->log( - $this->rejectionLevel, - 'Some data was rejected from the pipeline', - [ - 'line' => $line, - ] - ); + if ($bucket instanceof RejectionResultBucket) { + foreach ($bucket->walkRejection() as $line) { + $rejection->reject($line); + $state->reject(); + + $this->logger->log( + $this->rejectionLevel, + 'Some data was rejected from the pipeline', + [ + 'line' => $line, + ] + ); + } + } + + if ($bucket instanceof RejectionWithReasonResultBucket) { + foreach ($bucket->walkRejection() as $line) { + $rejection->rejectWithReason($line, $bucket->getReason()); + $state->reject(); + + $this->logger->log( + $this->rejectionLevel, + 'Some data was rejected from the pipeline', + [ + 'line' => $line, + ] + ); + } } } From dcdcd1872105f59de27df2296bee5885776112f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 13 Nov 2023 14:30:00 +0100 Subject: [PATCH 02/10] Updated pipeline contracts to v0.5 --- composer.json | 9 +- composer.lock | 72 +++++++++++-- src/Extractor/IteratorExtractor.php | 1 + src/Pipeline.php | 32 ++++-- src/PipelineRunner.php | 12 +-- src/StepCode.php | 25 +++++ tests/unit/PipelineRunnerTest.php | 4 +- tests/unit/PipelineTest.php | 156 ++++++++++++++++------------ 8 files changed, 215 insertions(+), 96 deletions(-) create mode 100644 src/StepCode.php diff --git a/composer.json b/composer.json index 6c2ff58..ddd57ee 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "php": "^8.2", "psr/log": "^3.0", "php-etl/bucket": "*", - "php-etl/pipeline-contracts": "0.4.*", + "php-etl/pipeline-contracts": "0.5.*", "php-etl/bucket-contracts": "0.2.*" }, "require-dev": { @@ -31,7 +31,7 @@ "rector/rector": "^0.15" }, "provide": { - "php-etl/pipeline-implementation": "0.3.0" + "php-etl/pipeline-implementation": "0.5.0" }, "autoload": { "psr-4": { @@ -46,12 +46,13 @@ "config": { "bin-dir": "bin", "allow-plugins": { - "infection/extension-installer": true + "infection/extension-installer": true, + "php-http/discovery": true } }, "extra": { "branch-alias": { - "dev-main": "0.5.x-dev" + "dev-main": "0.6.x-dev" } } } diff --git a/composer.lock b/composer.lock index e1a3591..3b14bd4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7a6f0d7130f4a8796f0f72c4b0ab06cd", + "content-hash": "2303e9c21649835612b5cdf4c66f5d0b", "packages": [ { "name": "php-etl/bucket", @@ -118,31 +118,33 @@ }, { "name": "php-etl/pipeline-contracts", - "version": "v0.4.0", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/pipeline-contracts.git", - "reference": "47e1e32aedb425c4624c1f6d9acf5ae839287fdf" + "reference": "ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/47e1e32aedb425c4624c1f6d9acf5ae839287fdf", - "reference": "47e1e32aedb425c4624c1f6d9acf5ae839287fdf", + "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f", + "reference": "ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f", "shasum": "" }, "require": { "php": "^8.2", - "php-etl/bucket-contracts": "0.2.0" + "php-etl/bucket-contracts": "0.2.*", + "php-etl/satellite-contracts": "0.1.*" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", "phpstan/phpstan": "^1.10", "rector/rector": "^0.15" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "0.4.x-dev" + "dev-main": "0.5.x-dev" } }, "autoload": { @@ -167,9 +169,61 @@ "description": "This library describes contracts for the Extract-Transform-Load pattern.", "support": { "issues": "https://github.com/php-etl/pipeline-contracts/issues", - "source": "https://github.com/php-etl/pipeline-contracts/tree/v0.4.0" + "source": "https://github.com/php-etl/pipeline-contracts/tree/main" }, - "time": "2023-04-06T10:08:37+00:00" + "time": "2023-11-13T13:11:27+00:00" + }, + { + "name": "php-etl/satellite-contracts", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-etl/satellite-contracts.git", + "reference": "1d2bc6822bfdb3efc6a1f490e706db995c99ef41" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-etl/satellite-contracts/zipball/1d2bc6822bfdb3efc6a1f490e706db995c99ef41", + "reference": "1d2bc6822bfdb3efc6a1f490e706db995c99ef41", + "shasum": "" + }, + "require": { + "php": "^8.2" + }, + "require-dev": { + "rector/rector": "^0.15.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kiboko\\Contract\\Satellite\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kiboko SAS", + "homepage": "http://kiboko.fr" + }, + { + "name": "Grégory Planchat", + "email": "gregory@kiboko.fr" + } + ], + "description": "This library describes contracts for defining satellite formats", + "support": { + "issues": "https://github.com/php-etl/satellite-contracts/issues", + "source": "https://github.com/php-etl/satellite-contracts/tree/v0.1.0" + }, + "time": "2023-04-18T13:53:22+00:00" }, { "name": "psr/log", diff --git a/src/Extractor/IteratorExtractor.php b/src/Extractor/IteratorExtractor.php index 86de9fb..d628c56 100644 --- a/src/Extractor/IteratorExtractor.php +++ b/src/Extractor/IteratorExtractor.php @@ -4,6 +4,7 @@ namespace Kiboko\Component\Pipeline\Extractor; +use Kiboko\Component\Bucket\AcceptanceResultBucket; use Kiboko\Contract\Pipeline\ExtractorInterface; class IteratorExtractor implements ExtractorInterface diff --git a/src/Pipeline.php b/src/Pipeline.php index d52da51..c476d7a 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -14,6 +14,9 @@ use Kiboko\Contract\Pipeline\RejectionInterface; use Kiboko\Contract\Pipeline\RunnableInterface; use Kiboko\Contract\Pipeline\StateInterface; +use Kiboko\Contract\Pipeline\StepCodeInterface; +use Kiboko\Contract\Pipeline\StepRejectionInterface; +use Kiboko\Contract\Pipeline\StepStateInterface; use Kiboko\Contract\Pipeline\TransformerInterface; use Kiboko\Contract\Pipeline\TransformingInterface; use Kiboko\Contract\Pipeline\WalkableInterface; @@ -23,8 +26,11 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterfac private readonly \AppendIterator $source; private iterable $subject; - public function __construct(private readonly PipelineRunnerInterface $runner, ?\Iterator $source = null) - { + public function __construct( + private readonly PipelineRunnerInterface $runner, + private readonly StateInterface $state, + ?\Iterator $source = null + ) { $this->source = new \AppendIterator(); $this->source->append($source ?? new \EmptyIterator()); @@ -39,14 +45,14 @@ public function feed(...$data): void private function passThroughCoroutine(): \Generator { $line = yield; - while ($line = yield $line) { - } + while ($line = yield $line); } public function extract( + StepCodeInterface $stepCode, ExtractorInterface $extractor, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): ExtractingInterface { $extract = $extractor->extract(); if (\is_array($extract)) { @@ -84,9 +90,10 @@ public function extract( } public function transform( + StepCodeInterface $stepCode, TransformerInterface $transformer, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): TransformingInterface { if ($transformer instanceof FlushableInterface) { $iterator = new \AppendIterator(); @@ -125,9 +132,10 @@ public function transform( } public function load( + StepCodeInterface $stepCode, LoaderInterface $loader, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): LoadingInterface { if ($loader instanceof FlushableInterface) { $iterator = new \AppendIterator(); @@ -168,7 +176,11 @@ public function load( public function walk(): \Iterator { + $this->state->initialize(); + yield from $this->subject; + + $this->state->teardown(); } public function run(int $interval = 1000): int diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index a61dbbf..10e2469 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -10,6 +10,8 @@ use Kiboko\Contract\Pipeline\PipelineRunnerInterface; use Kiboko\Contract\Pipeline\RejectionInterface; use Kiboko\Contract\Pipeline\StateInterface; +use Kiboko\Contract\Pipeline\StepRejectionInterface; +use Kiboko\Contract\Pipeline\StepStateInterface; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Psr\Log\NullLogger; @@ -23,12 +25,9 @@ public function __construct(private readonly LoggerInterface $logger = new NullL public function run( \Iterator $source, \Generator $coroutine, - RejectionInterface $rejection, - StateInterface $state, + StepRejectionInterface $rejection, + StepStateInterface $state, ): \Iterator { - $state->initialize(); - $rejection->initialize(); - $wrapper = new GeneratorWrapper(); $wrapper->rewind($source, $coroutine); @@ -69,8 +68,5 @@ public function run( $wrapper->next($source); } - - $state->teardown(); - $rejection->teardown(); } } diff --git a/src/StepCode.php b/src/StepCode.php new file mode 100644 index 0000000..2d92f90 --- /dev/null +++ b/src/StepCode.php @@ -0,0 +1,25 @@ +reference; + } +} diff --git a/tests/unit/PipelineRunnerTest.php b/tests/unit/PipelineRunnerTest.php index 9a21f6a..c60fae9 100644 --- a/tests/unit/PipelineRunnerTest.php +++ b/tests/unit/PipelineRunnerTest.php @@ -9,6 +9,8 @@ use Kiboko\Component\Pipeline\PipelineRunner; use Kiboko\Contract\Pipeline\NullRejection; use Kiboko\Contract\Pipeline\NullState; +use Kiboko\Contract\Pipeline\NullStepRejection; +use Kiboko\Contract\Pipeline\NullStepState; use PHPUnit\Framework\TestResult; use Psr\Log\NullLogger; @@ -115,7 +117,7 @@ public function testRun(\Iterator $source, callable $callback, array $expected): { $run = new PipelineRunner(new NullLogger()); - $it = $run->run($source, $callback(), new NullRejection(), new NullState()); + $it = $run->run($source, $callback(), new NullStepRejection(), new NullStepState()); $this->assertIteration(new \ArrayIterator($expected), $it); } diff --git a/tests/unit/PipelineTest.php b/tests/unit/PipelineTest.php index 7a368d1..d5f104c 100644 --- a/tests/unit/PipelineTest.php +++ b/tests/unit/PipelineTest.php @@ -7,12 +7,15 @@ use Kiboko\Component\Bucket\AcceptanceResultBucket; use Kiboko\Component\Pipeline\Pipeline; use Kiboko\Component\Pipeline\PipelineRunner; +use Kiboko\Component\Pipeline\StepCode; use Kiboko\Contract\Bucket\ResultBucketInterface; use Kiboko\Contract\Pipeline\ExtractorInterface; use Kiboko\Contract\Pipeline\FlushableInterface; use Kiboko\Contract\Pipeline\LoaderInterface; use Kiboko\Contract\Pipeline\NullRejection; use Kiboko\Contract\Pipeline\NullState; +use Kiboko\Contract\Pipeline\NullStepRejection; +use Kiboko\Contract\Pipeline\NullStepState; use Kiboko\Contract\Pipeline\TransformerInterface; use Psr\Log\NullLogger; @@ -23,16 +26,21 @@ final class PipelineTest extends IterableTestCase { public function testExtractorWithoutFlush(): void { - $pipeline = new Pipeline(new PipelineRunner(new NullLogger())); - - $pipeline->extract(new class() implements ExtractorInterface { - public function extract(): iterable - { - yield new AcceptanceResultBucket('lorem'); - yield new AcceptanceResultBucket('ipsum'); - yield new AcceptanceResultBucket('dolor'); - } - }, new NullRejection(), new NullState()); + $pipeline = new Pipeline(new PipelineRunner(new NullLogger()), new NullState()); + + $pipeline->extract( + StepCode::fromString('extractor'), + new class() implements ExtractorInterface { + public function extract(): iterable + { + yield new AcceptanceResultBucket('lorem'); + yield new AcceptanceResultBucket('ipsum'); + yield new AcceptanceResultBucket('dolor'); + } + }, + new NullStepRejection(), + new NullStepState() + ); $this->assertIteration( new \ArrayIterator(['lorem', 'ipsum', 'dolor']), @@ -42,98 +50,118 @@ public function extract(): iterable public function testTransformerWithoutFlush(): void { - $pipeline = new Pipeline(new PipelineRunner(new NullLogger())); + $pipeline = new Pipeline(new PipelineRunner(new NullLogger()), new NullState()); $pipeline->feed(['lorem'], ['ipsum'], ['dolor']); - $pipeline->transform(new class() implements TransformerInterface { - public function transform(): \Generator - { - $line = yield; - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - yield new AcceptanceResultBucket(str_rot13((string) $line)); - } - }, new NullRejection(), new NullState()); + $pipeline->transform( + StepCode::fromString('transformer'), + new class() implements TransformerInterface { + public function transform(): \Generator + { + $line = yield; + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + } + }, + new NullStepRejection(), + new NullStepState() + ); $this->assertIteration( - new \ArrayIterator(['yberz', 'vcfhz', 'qbybe']), + new \ArrayIterator([['yberz'], ['vcfhz'], ['qbybe']]), $pipeline->walk() ); } public function testTransformerWithFlush(): void { - $pipeline = new Pipeline(new PipelineRunner(new NullLogger())); + $pipeline = new Pipeline(new PipelineRunner(new NullLogger()), new NullState()); $pipeline->feed(['lorem'], ['ipsum'], ['dolor']); - $pipeline->transform(new class() implements TransformerInterface, FlushableInterface { - public function transform(): \Generator - { - $line = yield; - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - yield new AcceptanceResultBucket(str_rot13((string) $line)); - } - - public function flush(): ResultBucketInterface - { - return new AcceptanceResultBucket(str_rot13('sit amet')); - } - }, new NullRejection(), new NullState()); + $pipeline->transform( + StepCode::fromString('transformer'), + new class() implements TransformerInterface, FlushableInterface { + public function transform(): \Generator + { + $line = yield; + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + } + + public function flush(): ResultBucketInterface + { + return new AcceptanceResultBucket([str_rot13('sit amet')]); + } + }, + new NullStepRejection(), + new NullStepState() + ); $this->assertIteration( - new \ArrayIterator(['yberz', 'vcfhz', 'qbybe', 'fvg nzrg']), + new \ArrayIterator([['yberz'], ['vcfhz'], ['qbybe'], ['fvg nzrg']]), $pipeline->walk() ); } public function testLoaderWithoutFlush(): void { - $pipeline = new Pipeline(new PipelineRunner(new NullLogger())); + $pipeline = new Pipeline(new PipelineRunner(new NullLogger()), new NullState()); $pipeline->feed(['lorem'], ['ipsum'], ['dolor']); - $pipeline->load(new class() implements LoaderInterface { - public function load(): \Generator - { - $line = yield; - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - yield new AcceptanceResultBucket(str_rot13((string) $line)); - } - }, new NullRejection(), new NullState()); + $pipeline->load( + StepCode::fromString('loader'), + new class() implements LoaderInterface { + public function load(): \Generator + { + $line = yield; + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + } + }, + new NullStepRejection(), + new NullStepState() + ); $this->assertIteration( - new \ArrayIterator(['yberz', 'vcfhz', 'qbybe']), + new \ArrayIterator([['yberz'], ['vcfhz'], ['qbybe']]), $pipeline->walk() ); } public function testLoaderWithFlush(): void { - $pipeline = new Pipeline(new PipelineRunner(new NullLogger())); + $pipeline = new Pipeline(new PipelineRunner(new NullLogger()), new NullState()); $pipeline->feed(['lorem'], ['ipsum'], ['dolor']); - $pipeline->load(new class() implements LoaderInterface, FlushableInterface { - public function load(): \Generator - { - $line = yield; - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - $line = yield new AcceptanceResultBucket(str_rot13((string) $line)); - yield new AcceptanceResultBucket(str_rot13((string) $line)); - } - - public function flush(): ResultBucketInterface - { - return new AcceptanceResultBucket(str_rot13('sit amet')); - } - }, new NullRejection(), new NullState()); + $pipeline->load( + StepCode::fromString('loader'), + new class() implements LoaderInterface, FlushableInterface { + public function load(): \Generator + { + $line = yield; + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + $line = yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + yield new AcceptanceResultBucket(array_map(fn (string $item) => str_rot13($item), $line)); + } + + public function flush(): ResultBucketInterface + { + return new AcceptanceResultBucket([str_rot13('sit amet')]); + } + }, + new NullStepRejection(), + new NullStepState() + ); $this->assertIteration( - new \ArrayIterator(['yberz', 'vcfhz', 'qbybe', 'fvg nzrg']), + new \ArrayIterator([['yberz'], ['vcfhz'], ['qbybe'], ['fvg nzrg']]), $pipeline->walk() ); } From 1fbd054db39240c87dd659a855186e338d042339 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 13 Nov 2023 13:30:45 +0000 Subject: [PATCH 03/10] [rector] Rector fixes --- src/StepCode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StepCode.php b/src/StepCode.php index 2d92f90..ac1dfd7 100644 --- a/src/StepCode.php +++ b/src/StepCode.php @@ -6,10 +6,10 @@ use Kiboko\Contract\Pipeline\StepCodeInterface; -final class StepCode implements StepCodeInterface +final readonly class StepCode implements StepCodeInterface { private function __construct( - private readonly string $reference, + private string $reference, ) { } From 000076dae78eb05050b56fd702844a22d23c395d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 13 Nov 2023 18:10:24 +0100 Subject: [PATCH 04/10] Fixing PHPStan level 9 issues --- composer.lock | 768 ++++++++-------------- src/Extractor/ArrayExtractor.php | 5 + src/Extractor/IteratorExtractor.php | 6 +- src/GeneratorWrapper.php | 12 + src/IteratorLoggingWrapper.php | 137 ---- src/Loader/DebugLoader.php | 10 +- src/Loader/JSONStreamLoader.php | 10 +- src/Loader/LogLoader.php | 8 +- src/Loader/StderrLoader.php | 10 +- src/Loader/StdoutLoader.php | 10 +- src/Loader/StreamLoader.php | 11 +- src/Pipeline.php | 8 +- src/PipelineRunner.php | 49 +- src/Transformer/BatchingTransformer.php | 38 +- src/Transformer/CallableTransformer.php | 26 +- src/Transformer/ColumnTrimTransformer.php | 9 +- src/Transformer/FilterTransformer.php | 16 +- src/UnexpectedYieldedValueType.php | 27 +- 18 files changed, 466 insertions(+), 694 deletions(-) delete mode 100644 src/IteratorLoggingWrapper.php diff --git a/composer.lock b/composer.lock index 3b14bd4..be7e267 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2303e9c21649835612b5cdf4c66f5d0b", + "content-hash": "19f3f0589f701d6b3dcf9169515b6ed9", "packages": [ { "name": "php-etl/bucket", @@ -122,12 +122,12 @@ "source": { "type": "git", "url": "https://github.com/php-etl/pipeline-contracts.git", - "reference": "ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f" + "reference": "632e119b1cf722955870cac1120e92e30f705c48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f", - "reference": "ad3984db5bbf68104b1c01f3dc8a19c31a95ad4f", + "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/632e119b1cf722955870cac1120e92e30f705c48", + "reference": "632e119b1cf722955870cac1120e92e30f705c48", "shasum": "" }, "require": { @@ -171,7 +171,7 @@ "issues": "https://github.com/php-etl/pipeline-contracts/issues", "source": "https://github.com/php-etl/pipeline-contracts/tree/main" }, - "time": "2023-11-13T13:11:27+00:00" + "time": "2023-11-13T16:40:59+00:00" }, { "name": "php-etl/satellite-contracts", @@ -370,16 +370,16 @@ }, { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -421,7 +421,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -437,20 +437,20 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/semver", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", "shasum": "" }, "require": { @@ -500,9 +500,9 @@ "versioning" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.3.2" + "source": "https://github.com/composer/semver/tree/3.4.0" }, "funding": [ { @@ -518,7 +518,7 @@ "type": "tidelift" } ], - "time": "2022-04-01T19:23:25+00:00" + "time": "2023-08-31T09:50:34+00:00" }, { "name": "composer/xdebug-handler", @@ -586,159 +586,6 @@ ], "time": "2022-02-25T21:32:43+00:00" }, - { - "name": "doctrine/annotations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", - "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^2 || ^3", - "ext-tokenizer": "*", - "php": "^7.2 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^2.0", - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6", - "vimeo/psalm": "^4.10" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.1" - }, - "time": "2023-02-02T22:02:53+00:00" - }, - { - "name": "doctrine/lexer", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "84a527db05647743d50373e0ec53a152f2cde568" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", - "reference": "84a527db05647743d50373e0ec53a152f2cde568", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^9.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" - } - ], - "time": "2022-12-15T16:57:16+00:00" - }, { "name": "fidry/cpu-core-counter", "version": "0.4.1", @@ -802,23 +649,21 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.16.0", + "version": "v3.38.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc" + "reference": "7e6070026e76aa09d77a47519625c86593fb8e31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", - "reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7e6070026e76aa09d77a47519625c86593fb8e31", + "reference": "7e6070026e76aa09d77a47519625c86593fb8e31", "shasum": "" }, "require": { "composer/semver": "^3.3", "composer/xdebug-handler": "^3.0.3", - "doctrine/annotations": "^2", - "doctrine/lexer": "^2 || ^3", "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", @@ -835,6 +680,7 @@ "symfony/stopwatch": "^5.4 || ^6.0" }, "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.0", "mikey179/vfsstream": "^1.6.11", @@ -845,8 +691,6 @@ "phpspec/prophecy": "^1.16", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.6", - "phpunitgoodpractices/traits": "^1.9.2", "symfony/phpunit-bridge": "^6.2.3", "symfony/yaml": "^5.4 || ^6.0" }, @@ -886,7 +730,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.16.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.0" }, "funding": [ { @@ -894,7 +738,7 @@ "type": "github" } ], - "time": "2023-04-02T19:30:06+00:00" + "time": "2023-11-07T08:44:54+00:00" }, { "name": "infection/abstract-testframework-adapter", @@ -1075,16 +919,16 @@ }, { "name": "infection/infection", - "version": "0.26.19", + "version": "0.26.21", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f" + "reference": "9bbe4994d204587e0e27475e6681b66608a690a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f", - "reference": "bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f", + "url": "https://api.github.com/repos/infection/infection/zipball/9bbe4994d204587e0e27475e6681b66608a690a9", + "reference": "9bbe4994d204587e0e27475e6681b66608a690a9", "shasum": "" }, "require": { @@ -1102,7 +946,7 @@ "justinrainbow/json-schema": "^5.2.10", "nikic/php-parser": "^4.15.1", "ondram/ci-detector": "^4.1.0", - "php": "^8.0", + "php": "^8.1", "sanmai/later": "^0.1.1", "sanmai/pipeline": "^5.1 || ^6", "sebastian/diff": "^3.0.2 || ^4.0 || ^5.0", @@ -1114,6 +958,7 @@ "webmozart/assert": "^1.11" }, "conflict": { + "antecedent/patchwork": "<2.1.25", "dg/bypass-finals": "<1.4.1", "phpunit/php-code-coverage": ">9,<9.1.4 || >9.2.17,<9.2.21" }, @@ -1122,6 +967,7 @@ "ext-simplexml": "*", "fidry/makefile": "^0.2.0", "helmich/phpunit-json-assert": "^3.0", + "phpspec/prophecy": "^1.15", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1.0", "phpstan/phpstan": "^1.3.0", @@ -1187,7 +1033,7 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.26.19" + "source": "https://github.com/infection/infection/tree/0.26.21" }, "funding": [ { @@ -1199,20 +1045,20 @@ "type": "open_collective" } ], - "time": "2023-02-05T21:47:26+00:00" + "time": "2023-04-25T19:40:27+00:00" }, { "name": "justinrainbow/json-schema", - "version": "5.2.12", + "version": "v5.2.13", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60" + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", - "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", "shasum": "" }, "require": { @@ -1267,9 +1113,9 @@ ], "support": { "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/5.2.12" + "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13" }, - "time": "2022-04-13T08:02:27+00:00" + "time": "2023-09-26T02:20:38+00:00" }, { "name": "myclabs/deep-copy", @@ -1332,16 +1178,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -1382,9 +1228,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "ondram/ci-detector", @@ -1577,16 +1423,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.12", + "version": "1.10.41", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7b2aaf999e522e2b10011a594cf06dc37de7fbd8" + "reference": "c6174523c2a69231df55bdc65b61655e72876d76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7b2aaf999e522e2b10011a594cf06dc37de7fbd8", - "reference": "7b2aaf999e522e2b10011a594cf06dc37de7fbd8", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c6174523c2a69231df55bdc65b61655e72876d76", + "reference": "c6174523c2a69231df55bdc65b61655e72876d76", "shasum": "" }, "require": { @@ -1635,20 +1481,20 @@ "type": "tidelift" } ], - "time": "2023-04-12T10:33:29+00:00" + "time": "2023-11-05T12:57:57+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.0.2", + "version": "10.1.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4" + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/20800e84296ea4732f9a125e08ce86b4004ae3e4", - "reference": "20800e84296ea4732f9a125e08ce86b4004ae3e4", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e", + "reference": "355324ca4980b8916c18b9db29f3ef484078f26e", "shasum": "" }, "require": { @@ -1667,7 +1513,7 @@ "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1676,7 +1522,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.0-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -1704,7 +1550,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.2" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7" }, "funding": [ { @@ -1712,20 +1559,20 @@ "type": "github" } ], - "time": "2023-03-06T13:00:19+00:00" + "time": "2023-10-04T15:34:17+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.1", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { @@ -1764,7 +1611,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -1772,7 +1620,7 @@ "type": "github" } ], - "time": "2023-02-10T16:53:14+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", @@ -1839,16 +1687,16 @@ }, { "name": "phpunit/php-text-template", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", - "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { @@ -1886,7 +1734,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -1894,7 +1743,7 @@ "type": "github" } ], - "time": "2023-02-03T06:56:46+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", @@ -1957,16 +1806,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.0.19", + "version": "10.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "20c23e85c86e5c06d63538ba464e8054f4744e62" + "reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20c23e85c86e5c06d63538ba464e8054f4744e62", - "reference": "20c23e85c86e5c06d63538ba464e8054f4744e62", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cacd8b9dd224efa8eb28beb69004126c7ca1a1a1", + "reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1", "shasum": "" }, "require": { @@ -1980,7 +1829,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.0", + "phpunit/php-code-coverage": "^10.1.5", "phpunit/php-file-iterator": "^4.0", "phpunit/php-invoker": "^4.0", "phpunit/php-text-template": "^3.0", @@ -1990,8 +1839,8 @@ "sebastian/comparator": "^5.0", "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.0", - "sebastian/global-state": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", "sebastian/type": "^4.0", @@ -2006,7 +1855,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.0-dev" + "dev-main": "10.4-dev" } }, "autoload": { @@ -2038,7 +1887,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.2" }, "funding": [ { @@ -2054,56 +1903,7 @@ "type": "tidelift" } ], - "time": "2023-03-27T11:46:33+00:00" - }, - { - "name": "psr/cache", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" - }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2023-10-26T07:21:45+00:00" }, { "name": "psr/container", @@ -2210,21 +2010,21 @@ }, { "name": "rector/rector", - "version": "0.15.24", + "version": "0.15.25", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59" + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/716473919bcfdc27bdd2a32afb72adbf4c224e59", - "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/015935c7ed9e48a4f5895ba974f337e20a263841", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.1" + "phpstan/phpstan": "^1.10.14" }, "conflict": { "rector/rector-doctrine": "*", @@ -2259,7 +2059,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.24" + "source": "https://github.com/rectorphp/rector/tree/0.15.25" }, "funding": [ { @@ -2267,35 +2067,41 @@ "type": "github" } ], - "time": "2023-04-05T08:49:11+00:00" + "time": "2023-04-20T16:07:39+00:00" }, { "name": "sanmai/later", - "version": "0.1.2", + "version": "0.1.3", "source": { "type": "git", "url": "https://github.com/sanmai/later.git", - "reference": "9b659fecef2030193fd02402955bc39629d5606f" + "reference": "88a1d39965aa3659ceb96622e2801b9194d16e2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/later/zipball/9b659fecef2030193fd02402955bc39629d5606f", - "reference": "9b659fecef2030193fd02402955bc39629d5606f", + "url": "https://api.github.com/repos/sanmai/later/zipball/88a1d39965aa3659ceb96622e2801b9194d16e2c", + "reference": "88a1d39965aa3659ceb96622e2801b9194d16e2c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.13", - "infection/infection": ">=0.10.5", + "ergebnis/composer-normalize": "^2.8", + "friendsofphp/php-cs-fixer": "^3.35.1", + "infection/infection": ">=0.27.6", "phan/phan": ">=2", "php-coveralls/php-coveralls": "^2.0", - "phpstan/phpstan": ">=0.10", - "phpunit/phpunit": ">=7.4", + "phpstan/phpstan": ">=1.4.5", + "phpunit/phpunit": ">=9.5 <10", "vimeo/psalm": ">=2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.1.x-dev" + } + }, "autoload": { "files": [ "src/functions.php" @@ -2317,7 +2123,7 @@ "description": "Later: deferred wrapper object", "support": { "issues": "https://github.com/sanmai/later/issues", - "source": "https://github.com/sanmai/later/tree/0.1.2" + "source": "https://github.com/sanmai/later/tree/0.1.3" }, "funding": [ { @@ -2325,34 +2131,34 @@ "type": "github" } ], - "time": "2021-01-02T10:26:44+00:00" + "time": "2023-10-23T13:38:10+00:00" }, { "name": "sanmai/pipeline", - "version": "v6.4", + "version": "v6.9", "source": { "type": "git", "url": "https://github.com/sanmai/pipeline.git", - "reference": "9260c4d05da37d67a69075858f41a6e7fff43743" + "reference": "c48f45c22c3ce4140d071f7658fb151df1cc08ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sanmai/pipeline/zipball/9260c4d05da37d67a69075858f41a6e7fff43743", - "reference": "9260c4d05da37d67a69075858f41a6e7fff43743", + "url": "https://api.github.com/repos/sanmai/pipeline/zipball/c48f45c22c3ce4140d071f7658fb151df1cc08ea", + "reference": "c48f45c22c3ce4140d071f7658fb151df1cc08ea", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.8", - "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/php-cs-fixer": "^3.17", "infection/infection": ">=0.10.5", "league/pipeline": "^0.3 || ^1.0", "phan/phan": ">=1.1", "php-coveralls/php-coveralls": "^2.4.1", "phpstan/phpstan": ">=0.10", - "phpunit/phpunit": "^7.4 || ^8.1 || ^9.4", + "phpunit/phpunit": ">=9.4", "vimeo/psalm": ">=2" }, "type": "library", @@ -2382,7 +2188,7 @@ "description": "General-purpose collections pipeline", "support": { "issues": "https://github.com/sanmai/pipeline/issues", - "source": "https://github.com/sanmai/pipeline/tree/v6.4" + "source": "https://github.com/sanmai/pipeline/tree/v6.9" }, "funding": [ { @@ -2390,7 +2196,7 @@ "type": "github" } ], - "time": "2023-04-12T06:45:27+00:00" + "time": "2023-10-08T11:56:54+00:00" }, { "name": "sebastian/cli-parser", @@ -2561,16 +2367,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.0", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", - "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { @@ -2581,7 +2387,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { @@ -2625,7 +2431,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -2633,20 +2440,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:16+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", - "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", "shasum": "" }, "require": { @@ -2659,7 +2466,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.1-dev" } }, "autoload": { @@ -2682,7 +2489,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" }, "funding": [ { @@ -2690,20 +2498,20 @@ "type": "github" } ], - "time": "2023-02-03T06:59:47+00:00" + "time": "2023-09-28T11:50:59+00:00" }, { "name": "sebastian/diff", - "version": "5.0.1", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { @@ -2749,7 +2557,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -2757,7 +2565,7 @@ "type": "github" } ], - "time": "2023-03-23T05:12:41+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "sebastian/environment", @@ -2825,16 +2633,16 @@ }, { "name": "sebastian/exporter", - "version": "5.0.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", "shasum": "" }, "require": { @@ -2848,7 +2656,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2890,7 +2698,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" }, "funding": [ { @@ -2898,20 +2707,20 @@ "type": "github" } ], - "time": "2023-02-03T07:06:49+00:00" + "time": "2023-09-24T13:22:09+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "aab257c712de87b90194febd52e4d184551c2d44" + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", - "reference": "aab257c712de87b90194febd52e4d184551c2d44", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", "shasum": "" }, "require": { @@ -2951,7 +2760,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" }, "funding": [ { @@ -2959,20 +2769,20 @@ "type": "github" } ], - "time": "2023-02-03T07:07:38+00:00" + "time": "2023-07-19T07:19:23+00:00" }, { "name": "sebastian/lines-of-code", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", - "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", "shasum": "" }, "require": { @@ -3008,7 +2818,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" }, "funding": [ { @@ -3016,7 +2827,7 @@ "type": "github" } ], - "time": "2023-02-03T07:08:02+00:00" + "time": "2023-08-31T09:25:50+00:00" }, { "name": "sebastian/object-enumerator", @@ -3304,23 +3115,23 @@ }, { "name": "symfony/console", - "version": "v6.2.8", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b" + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3582d68a64a86ec25240aaa521ec8bc2342b369b", - "reference": "3582d68a64a86ec25240aaa521ec8bc2342b369b", + "url": "https://api.github.com/repos/symfony/console/zipball/0d14a9f6d04d4ac38a8cea1171f4554e325dae92", + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -3342,12 +3153,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -3380,7 +3185,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.8" + "source": "https://github.com/symfony/console/tree/v6.3.8" }, "funding": [ { @@ -3396,20 +3201,20 @@ "type": "tidelift" } ], - "time": "2023-03-29T21:42:15+00:00" + "time": "2023-10-31T08:09:35+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -3418,7 +3223,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3447,7 +3252,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -3463,28 +3268,29 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.2.8", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" + "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/adb01fe097a4ee930db9258a3cc906b5beb5cf2e", + "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2|^3" + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<5.4" + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", @@ -3497,13 +3303,9 @@ "symfony/error-handler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^5.4|^6.0" }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, "type": "library", "autoload": { "psr-4": { @@ -3530,7 +3332,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.8" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.2" }, "funding": [ { @@ -3546,33 +3348,30 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-07-06T06:56:43+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", - "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", "shasum": "" }, "require": { "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3609,7 +3408,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" }, "funding": [ { @@ -3625,20 +3424,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.7", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "82b6c62b959f642d000456f08c6d219d749215b3" + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", - "reference": "82b6c62b959f642d000456f08c6d219d749215b3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", "shasum": "" }, "require": { @@ -3672,7 +3471,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.7" + "source": "https://github.com/symfony/filesystem/tree/v6.3.1" }, "funding": [ { @@ -3688,20 +3487,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-06-01T08:30:39+00:00" }, { "name": "symfony/finder", - "version": "v6.2.7", + "version": "v6.3.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" + "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", + "url": "https://api.github.com/repos/symfony/finder/zipball/a1b31d88c0e998168ca7792f222cbecee47428c4", + "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4", "shasum": "" }, "require": { @@ -3736,7 +3535,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.2.7" + "source": "https://github.com/symfony/finder/tree/v6.3.5" }, "funding": [ { @@ -3752,25 +3551,25 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-09-26T12:56:25+00:00" }, { "name": "symfony/options-resolver", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", - "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a10f19f5198d589d5c33333cffe98dc9820332dd", + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3" + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -3803,7 +3602,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" + "source": "https://github.com/symfony/options-resolver/tree/v6.3.0" }, "funding": [ { @@ -3819,20 +3618,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-05-12T14:21:09+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -3847,7 +3646,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3885,7 +3684,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -3901,20 +3700,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -3926,7 +3725,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3966,7 +3765,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -3982,20 +3781,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -4007,7 +3806,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4050,7 +3849,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -4066,20 +3865,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -4094,7 +3893,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4133,7 +3932,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -4149,20 +3948,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -4171,7 +3970,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4216,7 +4015,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -4232,20 +4031,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", "shasum": "" }, "require": { @@ -4254,7 +4053,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4295,7 +4094,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" }, "funding": [ { @@ -4311,20 +4110,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/process", - "version": "v6.2.8", + "version": "v6.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "75ed64103df4f6615e15a7fe38b8111099f47416" + "reference": "0b5c29118f2e980d455d2e34a5659f4579847c54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/75ed64103df4f6615e15a7fe38b8111099f47416", - "reference": "75ed64103df4f6615e15a7fe38b8111099f47416", + "url": "https://api.github.com/repos/symfony/process/zipball/0b5c29118f2e980d455d2e34a5659f4579847c54", + "reference": "0b5c29118f2e980d455d2e34a5659f4579847c54", "shasum": "" }, "require": { @@ -4356,7 +4155,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.8" + "source": "https://github.com/symfony/process/tree/v6.3.4" }, "funding": [ { @@ -4372,20 +4171,20 @@ "type": "tidelift" } ], - "time": "2023-03-09T16:20:02+00:00" + "time": "2023-08-07T10:39:22+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -4395,13 +4194,10 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4441,7 +4237,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -4457,25 +4253,25 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/stopwatch", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f" + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", - "reference": "f3adc98c1061875dd2edcd45e5b04e63d0e29f8f", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/service-contracts": "^1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -4503,7 +4299,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v6.2.7" + "source": "https://github.com/symfony/stopwatch/tree/v6.3.0" }, "funding": [ { @@ -4519,20 +4315,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-02-16T10:14:28+00:00" }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "13880a87790c76ef994c91e87efb96134522577a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/13880a87790c76ef994c91e87efb96134522577a", + "reference": "13880a87790c76ef994c91e87efb96134522577a", "shasum": "" }, "require": { @@ -4543,13 +4339,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -4589,7 +4385,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.8" }, "funding": [ { @@ -4605,7 +4401,7 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-11-09T08:28:21+00:00" }, { "name": "thecodingmachine/safe", diff --git a/src/Extractor/ArrayExtractor.php b/src/Extractor/ArrayExtractor.php index e6cfa47..b79e0d8 100644 --- a/src/Extractor/ArrayExtractor.php +++ b/src/Extractor/ArrayExtractor.php @@ -6,8 +6,13 @@ use Kiboko\Contract\Pipeline\ExtractorInterface; +/** + * @template Type + * @implements ExtractorInterface + */ class ArrayExtractor implements ExtractorInterface { + /** @param non-empty-array $data */ public function __construct(private readonly array $data) { } diff --git a/src/Extractor/IteratorExtractor.php b/src/Extractor/IteratorExtractor.php index d628c56..0c79abf 100644 --- a/src/Extractor/IteratorExtractor.php +++ b/src/Extractor/IteratorExtractor.php @@ -4,11 +4,15 @@ namespace Kiboko\Component\Pipeline\Extractor; -use Kiboko\Component\Bucket\AcceptanceResultBucket; use Kiboko\Contract\Pipeline\ExtractorInterface; +/** + * @template Type + * @implements ExtractorInterface + */ class IteratorExtractor implements ExtractorInterface { + /** @param \Traversable $traversable */ public function __construct(private readonly \Traversable $traversable) { } diff --git a/src/GeneratorWrapper.php b/src/GeneratorWrapper.php index b147212..f319060 100644 --- a/src/GeneratorWrapper.php +++ b/src/GeneratorWrapper.php @@ -4,8 +4,14 @@ namespace Kiboko\Component\Pipeline; +use Kiboko\Contract\Bucket\ResultBucketInterface; + +/** + * @template Type + */ class GeneratorWrapper { + /** @param \Iterator ...$iterators */ public function rewind(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -13,6 +19,7 @@ public function rewind(\Iterator ...$iterators): void } } + /** @param \Iterator ...$iterators */ public function next(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -20,6 +27,7 @@ public function next(\Iterator ...$iterators): void } } + /** @param \Iterator ...$iterators */ public function valid(\Iterator ...$iterators): bool { foreach ($iterators as $iterator) { @@ -31,6 +39,10 @@ public function valid(\Iterator ...$iterators): bool return true; } + /** + * @param Type $value + * @param \Generator, Type|null, void> ...$generators + */ public function send($value, \Generator ...$generators): \Generator { foreach ($generators as $generator) { diff --git a/src/IteratorLoggingWrapper.php b/src/IteratorLoggingWrapper.php deleted file mode 100644 index b309d4a..0000000 --- a/src/IteratorLoggingWrapper.php +++ /dev/null @@ -1,137 +0,0 @@ -wrapped instanceof \Generator) { - try { - $this->reflectionGenerator = new \ReflectionGenerator($this->wrapped); - } catch (\ReflectionException $e) { - throw new \RuntimeException('An error occured during reflection.', 0, $e); - } - } - - try { - $this->reflectionObject = new \ReflectionObject($this->wrapped); - } catch (\ReflectionException $e) { - throw new \RuntimeException('An error occured during reflection.', 0, $e); - } - } - - private function debug(string $calledMethod, \Iterator $iterator, $value = null): void - { - try { - $message = 'Wrapped %type%->%iter% [%object%]: '; - if (null !== $this->reflectionGenerator) { - $function = $this->reflectionGenerator->getFunction(); - $functionName = $function->getName(); - - if ($function instanceof \ReflectionMethod) { - $class = $function->getDeclaringClass(); - $functionName = $class->getName().'::'.$function->getName(); - } - - $options = [ - 'iter' => $calledMethod, - 'object' => spl_object_hash($this->wrapped), - 'function' => var_export($functionName, true), - 'file' => var_export($this->reflectionGenerator->getExecutingFile(), true), - 'line' => var_export($this->reflectionGenerator->getExecutingLine(), true), - 'type' => $this->wrapped instanceof \Generator ? 'generator' : 'iterator', - ]; - } else { - $message = 'Wrapped %type%->%iter% [%object%]: [terminated] '; - - $options = [ - 'iter' => $calledMethod, - 'object' => spl_object_hash($this->wrapped), - 'type' => $this->wrapped instanceof \Generator ? 'generator' : 'iterator', - ]; - } - } catch (\ReflectionException) { - $message = 'Wrapped %type%->%iter% [%object%]: [terminated] '; - - $options = [ - 'iter' => $calledMethod, - 'object' => spl_object_hash($this->wrapped), - 'type' => $this->wrapped instanceof \Generator ? 'generator' : 'iterator', - ]; - } - - if (2 === \func_num_args()) { - $options = array_merge( - $options, - [ - 'value' => var_export($options, true), - ] - ); - } - - $parameters = []; - $fields = []; - foreach ($options as $key => $value) { - if (!\in_array($key, ['type', 'iter', 'object'])) { - $fields[] = $key.'=%'.$key.'%'; - $parameters['%'.$key.'%'] = var_export($value, true); - } else { - $parameters['%'.$key.'%'] = $value; - } - } - - $message .= implode(', ', $fields); - - $this->logger->debug(strtr($message, $parameters)); - } - - public function current(): mixed - { - $current = $this->wrapped->current(); - - $this->debug(__FUNCTION__, $this->wrapped, $current); - - return $current; - } - - public function next(): void - { - $this->wrapped->next(); - - $this->debug(__FUNCTION__, $this->wrapped); - } - - public function key(): mixed - { - $key = $this->wrapped->key(); - - $this->debug(__FUNCTION__, $this->wrapped, $key); - - return $key; - } - - public function valid(): bool - { - $valid = $this->wrapped->valid(); - - $this->debug(__FUNCTION__, $this->wrapped); - - return $valid; - } - - public function rewind(): void - { - $this->wrapped->rewind(); - - $this->debug(__FUNCTION__, $this->wrapped); - } -} diff --git a/src/Loader/DebugLoader.php b/src/Loader/DebugLoader.php index 3c83320..59286f0 100644 --- a/src/Loader/DebugLoader.php +++ b/src/Loader/DebugLoader.php @@ -4,9 +4,17 @@ namespace Kiboko\Component\Pipeline\Loader; +/** + * @template Type + * + * @extends StreamLoader + */ final class DebugLoader extends StreamLoader { - protected function formatLine($line) + /** + * @param Type|null $line + */ + protected function formatLine(mixed $line): string { return var_export($line, true).\PHP_EOL; } diff --git a/src/Loader/JSONStreamLoader.php b/src/Loader/JSONStreamLoader.php index 4e9799f..76b4c06 100644 --- a/src/Loader/JSONStreamLoader.php +++ b/src/Loader/JSONStreamLoader.php @@ -4,9 +4,17 @@ namespace Kiboko\Component\Pipeline\Loader; +/** + * @template Type + * + * @extends StreamLoader + */ final class JSONStreamLoader extends StreamLoader { - protected function formatLine($line) + /** + * @param Type|null $line + */ + protected function formatLine(mixed $line): string { return json_encode($line, \JSON_THROW_ON_ERROR).\PHP_EOL; } diff --git a/src/Loader/LogLoader.php b/src/Loader/LogLoader.php index 511a357..025b1b1 100644 --- a/src/Loader/LogLoader.php +++ b/src/Loader/LogLoader.php @@ -13,7 +13,7 @@ /** * @template Type * - * @template-implements LoaderInterface + * @implements LoaderInterface */ final readonly class LogLoader implements LoaderInterface { @@ -25,8 +25,10 @@ public function __construct(private LoggerInterface $logger, private string $log public function load(): \Generator { $line = yield new EmptyResultBucket(); - do { + /** @phpstan-ignore-next-line */ + while (true) { $this->logger->log($this->logLevel, var_export($line, true)); - } while ($line = yield new AcceptanceResultBucket($line)); + $line = yield new AcceptanceResultBucket($line); + } } } diff --git a/src/Loader/StderrLoader.php b/src/Loader/StderrLoader.php index 3211e12..fa615d7 100644 --- a/src/Loader/StderrLoader.php +++ b/src/Loader/StderrLoader.php @@ -4,6 +4,11 @@ namespace Kiboko\Component\Pipeline\Loader; +/** + * @template Type + * + * @extends StreamLoader + */ final class StderrLoader extends StreamLoader { public function __construct() @@ -11,7 +16,10 @@ public function __construct() parent::__construct(\STDOUT); } - protected function formatLine($line) + /** + * @param Type|null $line + */ + protected function formatLine(mixed $line): string { return var_export($line, true).\PHP_EOL; } diff --git a/src/Loader/StdoutLoader.php b/src/Loader/StdoutLoader.php index 32199dd..0f4b609 100644 --- a/src/Loader/StdoutLoader.php +++ b/src/Loader/StdoutLoader.php @@ -4,6 +4,11 @@ namespace Kiboko\Component\Pipeline\Loader; +/** + * @template Type + * + * @extends StreamLoader + */ final class StdoutLoader extends StreamLoader { public function __construct() @@ -11,7 +16,10 @@ public function __construct() parent::__construct(\STDOUT); } - protected function formatLine($line) + /** + * @param Type|null $line + */ + protected function formatLine(mixed $line): string { return var_export($line, true).\PHP_EOL; } diff --git a/src/Loader/StreamLoader.php b/src/Loader/StreamLoader.php index 7690fad..b1ec393 100644 --- a/src/Loader/StreamLoader.php +++ b/src/Loader/StreamLoader.php @@ -11,7 +11,7 @@ /** * @template Type * - * @template-implements LoaderInterface + * @implements LoaderInterface */ abstract class StreamLoader implements LoaderInterface { @@ -32,11 +32,16 @@ public function __construct($stream) public function load(): \Generator { $line = yield new EmptyResultBucket(); + /** @phpstan-ignore-next-line */ while (true) { - fwrite($this->stream, (string) $this->formatLine($line)); + fwrite($this->stream, $this->formatLine($line)); $line = yield new AcceptanceResultBucket($line); } } - abstract protected function formatLine($line); + /** + * @param Type|null $line + * @return string + */ + abstract protected function formatLine(mixed $line): string; } diff --git a/src/Pipeline.php b/src/Pipeline.php index c476d7a..a707f98 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -24,8 +24,12 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterface { private readonly \AppendIterator $source; + /** @var iterable|\NoRewindIterator */ private iterable $subject; + /** + * @param PipelineRunnerInterface $runner + */ public function __construct( private readonly PipelineRunnerInterface $runner, private readonly StateInterface $state, @@ -45,7 +49,9 @@ public function feed(...$data): void private function passThroughCoroutine(): \Generator { $line = yield; - while ($line = yield $line); + while (true) { + $line = yield $line; + } } public function extract( diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index 0022641..a9a7ae0 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -18,10 +18,17 @@ use Psr\Log\LogLevel; use Psr\Log\NullLogger; +/** + * @template Type + * + * @implements PipelineRunnerInterface + */ class PipelineRunner implements PipelineRunnerInterface { - public function __construct(private readonly LoggerInterface $logger = new NullLogger(), private readonly string $rejectionLevel = LogLevel::WARNING) - { + public function __construct( + private readonly LoggerInterface $logger = new NullLogger(), + private readonly LogLevel|string $rejectionLevel = LogLevel::WARNING + ) { } public function run( @@ -45,34 +52,18 @@ public function run( } if ($bucket instanceof RejectionResultBucketInterface) { - if ($bucket instanceof RejectionResultBucket) { - foreach ($bucket->walkRejection() as $line) { - $rejection->reject($line); - $state->reject(); + foreach ($bucket->walkRejection() as $line) { + $rejection->reject($line); + $rejection->rejectWithReason($line, implode('', $bucket->reasons())); + $state->reject(); - $this->logger->log( - $this->rejectionLevel, - 'Some data was rejected from the pipeline', - [ - 'line' => $line, - ] - ); - } - } - - if ($bucket instanceof RejectionWithReasonResultBucket) { - foreach ($bucket->walkRejection() as $line) { - $rejection->rejectWithReason($line, $bucket->getReason()); - $state->reject(); - - $this->logger->log( - $this->rejectionLevel, - 'Some data was rejected from the pipeline', - [ - 'line' => $line, - ] - ); - } + $this->logger->log( + $this->rejectionLevel, + 'Some data was rejected from the pipeline', + [ + 'line' => $line, + ] + ); } } diff --git a/src/Transformer/BatchingTransformer.php b/src/Transformer/BatchingTransformer.php index 0b5156a..adf7791 100644 --- a/src/Transformer/BatchingTransformer.php +++ b/src/Transformer/BatchingTransformer.php @@ -4,36 +4,49 @@ namespace Kiboko\Component\Pipeline\Transformer; +use Kiboko\Component\Bucket\AcceptanceAppendableResultBucket; +use Kiboko\Component\Bucket\AcceptanceResultBucket; use Kiboko\Component\Bucket\AppendableIteratorAcceptanceResultBucket; use Kiboko\Component\Bucket\EmptyResultBucket; use Kiboko\Contract\Bucket\ResultBucketInterface; use Kiboko\Contract\Pipeline\FlushableInterface; use Kiboko\Contract\Pipeline\TransformerInterface; -/** @template Type */ +/** + * @template Type + * + * @implements TransformerInterface> + * @implements FlushableInterface> + */ class BatchingTransformer implements TransformerInterface, FlushableInterface { - private ResultBucketInterface $bucket; + /** @var list */ + private array $batch = []; - public function __construct(private readonly int $batchSize) - { - $this->bucket = new EmptyResultBucket(); + public function __construct( + private readonly int $batchSize + ) { } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** @return \Generator>|EmptyResultBucket, Type|null, void> */ public function transform(): \Generator { - $this->bucket = new AppendableIteratorAcceptanceResultBucket(); + $this->batch = []; $itemCount = 0; $line = yield new EmptyResultBucket(); + /** @phpstan-ignore-next-line */ while (true) { - $this->bucket->append($line); + if ($line === null) { + $line = yield new EmptyResultBucket(); + continue; + } + $this->batch[] = $line; if ($this->batchSize <= ++$itemCount) { - $line = yield $this->bucket; + $line = yield new AcceptanceResultBucket($this->batch); $itemCount = 0; - $this->bucket = new AppendableIteratorAcceptanceResultBucket(); + $this->batch = []; } else { $line = yield new EmptyResultBucket(); } @@ -42,6 +55,9 @@ public function transform(): \Generator public function flush(): ResultBucketInterface { - return $this->bucket; + if (count($this->batch) <= 0) { + return new EmptyResultBucket(); + } + return new AcceptanceResultBucket($this->batch); } } diff --git a/src/Transformer/CallableTransformer.php b/src/Transformer/CallableTransformer.php index 7fd2761..5c469f9 100644 --- a/src/Transformer/CallableTransformer.php +++ b/src/Transformer/CallableTransformer.php @@ -8,23 +8,37 @@ use Kiboko\Component\Bucket\EmptyResultBucket; use Kiboko\Contract\Pipeline\TransformerInterface; -/** @template Type */ +/** + * @template InputType + * @template OutputType + * + * @template-implements TransformerInterface + */ class CallableTransformer implements TransformerInterface { - /** @var callable */ + /** @var callable(InputType|null $item): OutputType */ private $callback; + /** + * @param callable(InputType|null $item): OutputType $callback + */ public function __construct( - callable $callback + callable $callback, ) { $this->callback = $callback; } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** + * @return \Generator|EmptyResultBucket, InputType|null, void> + */ public function transform(): \Generator { + $callback = $this->callback; + $line = yield new EmptyResultBucket(); - do { - } while ($line = yield new AcceptanceResultBucket(($this->callback)($line))); + /** @phpstan-ignore-next-line */ + while (true) { + $line = yield new AcceptanceResultBucket($callback($line)); + } } } diff --git a/src/Transformer/ColumnTrimTransformer.php b/src/Transformer/ColumnTrimTransformer.php index a3f87dc..95490f8 100644 --- a/src/Transformer/ColumnTrimTransformer.php +++ b/src/Transformer/ColumnTrimTransformer.php @@ -9,9 +9,7 @@ use Kiboko\Contract\Pipeline\TransformerInterface; /** - * @template Type - * - * @template-implements TransformerInterface + * @template-implements TransformerInterface, non-empty-array> */ class ColumnTrimTransformer implements TransformerInterface { @@ -21,10 +19,13 @@ public function __construct( ) { } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** + * @return \Generator>|EmptyResultBucket, non-empty-array|null, void> + */ public function transform(): \Generator { $line = yield new EmptyResultBucket(); + /** @phpstan-ignore-next-line */ while (true) { if (null === $line) { $line = yield new EmptyResultBucket(); diff --git a/src/Transformer/FilterTransformer.php b/src/Transformer/FilterTransformer.php index e8b6fa1..8f6d082 100644 --- a/src/Transformer/FilterTransformer.php +++ b/src/Transformer/FilterTransformer.php @@ -6,32 +6,36 @@ use Kiboko\Component\Bucket\AcceptanceResultBucket; use Kiboko\Component\Bucket\EmptyResultBucket; -use Kiboko\Component\Metadata\Type; use Kiboko\Contract\Pipeline\TransformerInterface; /** * @template Type * - * @template-implements TransformerInterface + * @template-implements TransformerInterface */ class FilterTransformer implements TransformerInterface { - /** @var callable */ + /** @var callable(Type $item): bool */ private $callback; - public function __construct(callable $callback) - { + /** + * @param callable(Type $item): bool $callback + */ + public function __construct( + callable $callback, + ) { $this->callback = $callback; } /** - * @return \Generator|EmptyResultBucket, Type|null, void> + * @return \Generator|EmptyResultBucket, Type|null, void> */ public function transform(): \Generator { $callback = $this->callback; $line = yield new EmptyResultBucket(); + /** @phpstan-ignore-next-line */ while (true) { if (null === $line || !$callback($line)) { $line = yield new EmptyResultBucket(); diff --git a/src/UnexpectedYieldedValueType.php b/src/UnexpectedYieldedValueType.php index a153d65..cc896ee 100644 --- a/src/UnexpectedYieldedValueType.php +++ b/src/UnexpectedYieldedValueType.php @@ -4,14 +4,35 @@ namespace Kiboko\Component\Pipeline; +use Kiboko\Contract\Bucket\ResultBucketInterface; + +/** + * @template InputType + * @template OutputType + */ final class UnexpectedYieldedValueType extends \UnexpectedValueException { - public function __construct(private readonly \Generator $coroutine, string $message = null, int $code = null, ?\Exception $previous = null) - { + public function __construct( + private readonly \Generator $coroutine, + string $message = '', + int $code = 0, + ?\Throwable $previous = null + ) { parent::__construct($message, $code, $previous); } - public static function expectingTypes(\Generator $coroutine, array $expectedTypes, $actual, int $code = null, ?\Exception $previous = null): self + public function getCoroutine(): \Generator + { + return $this->coroutine; + } + + /** + * @param \Generator, InputType|null, void> $actual + * @param list $expectedTypes + * @param mixed $actual + * @return UnexpectedYieldedValueType + */ + public static function expectingTypes(\Generator $coroutine, array $expectedTypes, $actual, int $code = 0, ?\Throwable $previous = null): self { try { $re = new \ReflectionGenerator($coroutine); From 141ef989e227261cb8b44c9a13b552712bfcb401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Mon, 13 Nov 2023 18:32:41 +0100 Subject: [PATCH 05/10] Fixing PHPStan level 9 issues --- src/GeneratorWrapper.php | 8 ++++---- src/Pipeline.php | 4 +--- src/PipelineRunner.php | 13 ++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/GeneratorWrapper.php b/src/GeneratorWrapper.php index f319060..d2e3ebf 100644 --- a/src/GeneratorWrapper.php +++ b/src/GeneratorWrapper.php @@ -11,7 +11,7 @@ */ class GeneratorWrapper { - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function rewind(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -19,7 +19,7 @@ public function rewind(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function next(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -27,7 +27,7 @@ public function next(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function valid(\Iterator ...$iterators): bool { foreach ($iterators as $iterator) { @@ -41,7 +41,7 @@ public function valid(\Iterator ...$iterators): bool /** * @param Type $value - * @param \Generator, Type|null, void> ...$generators + * @param \Generator, Type, void> ...$generators */ public function send($value, \Generator ...$generators): \Generator { diff --git a/src/Pipeline.php b/src/Pipeline.php index a707f98..f7ffcbd 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -27,9 +27,6 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterfac /** @var iterable|\NoRewindIterator */ private iterable $subject; - /** - * @param PipelineRunnerInterface $runner - */ public function __construct( private readonly PipelineRunnerInterface $runner, private readonly StateInterface $state, @@ -49,6 +46,7 @@ public function feed(...$data): void private function passThroughCoroutine(): \Generator { $line = yield; + /** @phpstan-ignore-next-line */ while (true) { $line = yield $line; } diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index a9a7ae0..09678c7 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -18,11 +18,6 @@ use Psr\Log\LogLevel; use Psr\Log\NullLogger; -/** - * @template Type - * - * @implements PipelineRunnerInterface - */ class PipelineRunner implements PipelineRunnerInterface { public function __construct( @@ -52,9 +47,13 @@ public function run( } if ($bucket instanceof RejectionResultBucketInterface) { + $reasons = $bucket->reasons(); foreach ($bucket->walkRejection() as $line) { - $rejection->reject($line); - $rejection->rejectWithReason($line, implode('', $bucket->reasons())); + if ($reasons !== null) { + $rejection->rejectWithReason($line, implode(PHP_EOL, $reasons)); + } else { + $rejection->reject($line); + } $state->reject(); $this->logger->log( From f5f87d27ad9d99b14817579b52783b177812bf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 14 Nov 2023 12:38:41 +0100 Subject: [PATCH 06/10] Fixing PHPStan level 4 issues --- composer.json | 3 +- composer.lock | 56 ++++++++++++----------- src/Extractor/ArrayExtractor.php | 2 +- src/Extractor/IteratorExtractor.php | 2 +- src/GeneratorWrapper.php | 10 ++-- src/Loader/DebugLoader.php | 2 +- src/Loader/JSONStreamLoader.php | 2 +- src/Loader/LogLoader.php | 9 +++- src/Loader/StderrLoader.php | 2 +- src/Loader/StdoutLoader.php | 2 +- src/Loader/StreamLoader.php | 9 +++- src/Pipeline.php | 38 ++++++++++++--- src/PipelineRunner.php | 16 +++++-- src/Transformer/BatchingTransformer.php | 28 +++++++----- src/Transformer/CallableTransformer.php | 13 ++++-- src/Transformer/ColumnTrimTransformer.php | 10 ++-- src/Transformer/FilterTransformer.php | 10 ++-- src/UnexpectedYieldedValueType.php | 9 ++-- 18 files changed, 139 insertions(+), 84 deletions(-) diff --git a/composer.json b/composer.json index ddd57ee..6d10135 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,7 @@ "php": "^8.2", "psr/log": "^3.0", "php-etl/bucket": "*", - "php-etl/pipeline-contracts": "0.5.*", - "php-etl/bucket-contracts": "0.2.*" + "php-etl/pipeline-contracts": "0.5.*" }, "require-dev": { "phpunit/php-invoker": "^4.0", diff --git a/composer.lock b/composer.lock index be7e267..2121a79 100644 --- a/composer.lock +++ b/composer.lock @@ -4,25 +4,25 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "19f3f0589f701d6b3dcf9169515b6ed9", + "content-hash": "04a6a721717460b4425a9ead233ee49c", "packages": [ { "name": "php-etl/bucket", - "version": "v0.3.0", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/bucket.git", - "reference": "4c63c1a55f93956634a53662dfd4cde1833ddcee" + "reference": "96b2549417b603abdee3f193d7d3074c0672f45a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/bucket/zipball/4c63c1a55f93956634a53662dfd4cde1833ddcee", - "reference": "4c63c1a55f93956634a53662dfd4cde1833ddcee", + "url": "https://api.github.com/repos/php-etl/bucket/zipball/96b2549417b603abdee3f193d7d3074c0672f45a", + "reference": "96b2549417b603abdee3f193d7d3074c0672f45a", "shasum": "" }, "require": { "php": "^8.2", - "php-etl/bucket-contracts": "0.2.*" + "php-etl/bucket-contracts": "0.3.*" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", @@ -30,10 +30,11 @@ "phpstan/phpstan": "^1.10", "rector/rector": "^0.15" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "0.3.x-dev" + "dev-main": "0.4.x-dev" } }, "autoload": { @@ -58,22 +59,22 @@ "description": "This library implements the Extract-Transform-Load pattern asynchronously in PHP with the help of iterators and generators", "support": { "issues": "https://github.com/php-etl/bucket/issues", - "source": "https://github.com/php-etl/bucket/tree/v0.3.0" + "source": "https://github.com/php-etl/bucket/tree/main" }, - "time": "2023-04-12T12:40:59+00:00" + "time": "2023-11-14T10:16:20+00:00" }, { "name": "php-etl/bucket-contracts", - "version": "v0.2.0", + "version": "dev-main", "source": { "type": "git", "url": "https://github.com/php-etl/bucket-contracts.git", - "reference": "e96726f9b89dea7308482fa6c2ce4db0757960ce" + "reference": "b9595871228a1c41e9da9c6d9e883a28123f4a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/bucket-contracts/zipball/e96726f9b89dea7308482fa6c2ce4db0757960ce", - "reference": "e96726f9b89dea7308482fa6c2ce4db0757960ce", + "url": "https://api.github.com/repos/php-etl/bucket-contracts/zipball/b9595871228a1c41e9da9c6d9e883a28123f4a10", + "reference": "b9595871228a1c41e9da9c6d9e883a28123f4a10", "shasum": "" }, "require": { @@ -84,10 +85,11 @@ "phpstan/phpstan": "^1.10", "rector/rector": "^0.15" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-main": "0.2.x-dev" + "dev-main": "0.3.x-dev" } }, "autoload": { @@ -112,9 +114,9 @@ "description": "This library describes contracts for the data-interchange buckets.", "support": { "issues": "https://github.com/php-etl/bucket-contracts/issues", - "source": "https://github.com/php-etl/bucket-contracts/tree/v0.2.0" + "source": "https://github.com/php-etl/bucket-contracts/tree/main" }, - "time": "2023-04-03T12:42:10+00:00" + "time": "2023-11-14T08:49:46+00:00" }, { "name": "php-etl/pipeline-contracts", @@ -122,17 +124,17 @@ "source": { "type": "git", "url": "https://github.com/php-etl/pipeline-contracts.git", - "reference": "632e119b1cf722955870cac1120e92e30f705c48" + "reference": "18f75049a19c137ba46c8b7d10dce4e4a502cf39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/632e119b1cf722955870cac1120e92e30f705c48", - "reference": "632e119b1cf722955870cac1120e92e30f705c48", + "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/18f75049a19c137ba46c8b7d10dce4e4a502cf39", + "reference": "18f75049a19c137ba46c8b7d10dce4e4a502cf39", "shasum": "" }, "require": { "php": "^8.2", - "php-etl/bucket-contracts": "0.2.*", + "php-etl/bucket-contracts": "0.3.*", "php-etl/satellite-contracts": "0.1.*" }, "require-dev": { @@ -171,7 +173,7 @@ "issues": "https://github.com/php-etl/pipeline-contracts/issues", "source": "https://github.com/php-etl/pipeline-contracts/tree/main" }, - "time": "2023-11-13T16:40:59+00:00" + "time": "2023-11-14T10:45:05+00:00" }, { "name": "php-etl/satellite-contracts", @@ -649,16 +651,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.38.0", + "version": "v3.38.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "7e6070026e76aa09d77a47519625c86593fb8e31" + "reference": "d872cdd543797ade030aaa307c0a4954a712e081" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7e6070026e76aa09d77a47519625c86593fb8e31", - "reference": "7e6070026e76aa09d77a47519625c86593fb8e31", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d872cdd543797ade030aaa307c0a4954a712e081", + "reference": "d872cdd543797ade030aaa307c0a4954a712e081", "shasum": "" }, "require": { @@ -730,7 +732,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.2" }, "funding": [ { @@ -738,7 +740,7 @@ "type": "github" } ], - "time": "2023-11-07T08:44:54+00:00" + "time": "2023-11-14T00:19:22+00:00" }, { "name": "infection/abstract-testframework-adapter", diff --git a/src/Extractor/ArrayExtractor.php b/src/Extractor/ArrayExtractor.php index b79e0d8..c6c71cc 100644 --- a/src/Extractor/ArrayExtractor.php +++ b/src/Extractor/ArrayExtractor.php @@ -7,7 +7,7 @@ use Kiboko\Contract\Pipeline\ExtractorInterface; /** - * @template Type + * @template Type of non-empty-array|object * @implements ExtractorInterface */ class ArrayExtractor implements ExtractorInterface diff --git a/src/Extractor/IteratorExtractor.php b/src/Extractor/IteratorExtractor.php index 0c79abf..46cf7ec 100644 --- a/src/Extractor/IteratorExtractor.php +++ b/src/Extractor/IteratorExtractor.php @@ -7,7 +7,7 @@ use Kiboko\Contract\Pipeline\ExtractorInterface; /** - * @template Type + * @template Type of non-empty-array|object * @implements ExtractorInterface */ class IteratorExtractor implements ExtractorInterface diff --git a/src/GeneratorWrapper.php b/src/GeneratorWrapper.php index d2e3ebf..f662c69 100644 --- a/src/GeneratorWrapper.php +++ b/src/GeneratorWrapper.php @@ -7,11 +7,11 @@ use Kiboko\Contract\Bucket\ResultBucketInterface; /** - * @template Type + * @template Type of non-empty-array|object */ class GeneratorWrapper { - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function rewind(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -19,7 +19,7 @@ public function rewind(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function next(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -27,7 +27,7 @@ public function next(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator ...$iterators */ public function valid(\Iterator ...$iterators): bool { foreach ($iterators as $iterator) { @@ -41,7 +41,7 @@ public function valid(\Iterator ...$iterators): bool /** * @param Type $value - * @param \Generator, Type, void> ...$generators + * @param \Generator, Type, void> ...$generators */ public function send($value, \Generator ...$generators): \Generator { diff --git a/src/Loader/DebugLoader.php b/src/Loader/DebugLoader.php index 59286f0..aa69550 100644 --- a/src/Loader/DebugLoader.php +++ b/src/Loader/DebugLoader.php @@ -5,7 +5,7 @@ namespace Kiboko\Component\Pipeline\Loader; /** - * @template Type + * @template Type of non-empty-array|object * * @extends StreamLoader */ diff --git a/src/Loader/JSONStreamLoader.php b/src/Loader/JSONStreamLoader.php index 76b4c06..755614d 100644 --- a/src/Loader/JSONStreamLoader.php +++ b/src/Loader/JSONStreamLoader.php @@ -5,7 +5,7 @@ namespace Kiboko\Component\Pipeline\Loader; /** - * @template Type + * @template Type of non-empty-array|object * * @extends StreamLoader */ diff --git a/src/Loader/LogLoader.php b/src/Loader/LogLoader.php index 025b1b1..02ef5c7 100644 --- a/src/Loader/LogLoader.php +++ b/src/Loader/LogLoader.php @@ -11,7 +11,7 @@ use Psr\Log\LogLevel; /** - * @template Type + * @template Type of non-empty-array|object * * @implements LoaderInterface */ @@ -21,12 +21,17 @@ public function __construct(private LoggerInterface $logger, private string $log { } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** @return \Generator|EmptyResultBucket, Type|null, void> */ public function load(): \Generator { $line = yield new EmptyResultBucket(); /** @phpstan-ignore-next-line */ while (true) { + if ($line === null) { + $line = yield new EmptyResultBucket(); + continue; + } + $this->logger->log($this->logLevel, var_export($line, true)); $line = yield new AcceptanceResultBucket($line); } diff --git a/src/Loader/StderrLoader.php b/src/Loader/StderrLoader.php index fa615d7..e11efbb 100644 --- a/src/Loader/StderrLoader.php +++ b/src/Loader/StderrLoader.php @@ -5,7 +5,7 @@ namespace Kiboko\Component\Pipeline\Loader; /** - * @template Type + * @template Type of non-empty-array|object * * @extends StreamLoader */ diff --git a/src/Loader/StdoutLoader.php b/src/Loader/StdoutLoader.php index 0f4b609..b5caeb2 100644 --- a/src/Loader/StdoutLoader.php +++ b/src/Loader/StdoutLoader.php @@ -5,7 +5,7 @@ namespace Kiboko\Component\Pipeline\Loader; /** - * @template Type + * @template Type of non-empty-array|object * * @extends StreamLoader */ diff --git a/src/Loader/StreamLoader.php b/src/Loader/StreamLoader.php index b1ec393..fd98b6e 100644 --- a/src/Loader/StreamLoader.php +++ b/src/Loader/StreamLoader.php @@ -9,7 +9,7 @@ use Kiboko\Contract\Pipeline\LoaderInterface; /** - * @template Type + * @template Type of non-empty-array|object * * @implements LoaderInterface */ @@ -28,12 +28,17 @@ public function __construct($stream) $this->stream = $stream; } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** @return \Generator|EmptyResultBucket, Type|null, void> */ public function load(): \Generator { $line = yield new EmptyResultBucket(); /** @phpstan-ignore-next-line */ while (true) { + if ($line === null) { + $line = yield new EmptyResultBucket(); + continue; + } + fwrite($this->stream, $this->formatLine($line)); $line = yield new AcceptanceResultBucket($line); } diff --git a/src/Pipeline.php b/src/Pipeline.php index f7ffcbd..be37897 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -11,8 +11,6 @@ use Kiboko\Contract\Pipeline\LoadingInterface; use Kiboko\Contract\Pipeline\PipelineInterface; use Kiboko\Contract\Pipeline\PipelineRunnerInterface; -use Kiboko\Contract\Pipeline\RejectionInterface; -use Kiboko\Contract\Pipeline\RunnableInterface; use Kiboko\Contract\Pipeline\StateInterface; use Kiboko\Contract\Pipeline\StepCodeInterface; use Kiboko\Contract\Pipeline\StepRejectionInterface; @@ -20,11 +18,13 @@ use Kiboko\Contract\Pipeline\TransformerInterface; use Kiboko\Contract\Pipeline\TransformingInterface; use Kiboko\Contract\Pipeline\WalkableInterface; +use Kiboko\Contract\Satellite\RunnableInterface; class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterface { + /** @var \AppendIterator|object, \Iterator|object>> */ private readonly \AppendIterator $source; - /** @var iterable|\NoRewindIterator */ + /** @var \Iterator|object>|\NoRewindIterator */ private iterable $subject; public function __construct( @@ -38,6 +38,12 @@ public function __construct( $this->subject = new \NoRewindIterator($this->source); } + /** + * @template InputType of non-empty-array|object + * + * @param InputType ...$data + * @return void + */ public function feed(...$data): void { $this->source->append(new \ArrayIterator($data)); @@ -52,6 +58,12 @@ private function passThroughCoroutine(): \Generator } } + /** + * @template Type of non-empty-array|object + * + * @param ExtractorInterface $extractor + * @param StepRejectionInterface $rejection + */ public function extract( StepCodeInterface $stepCode, ExtractorInterface $extractor, @@ -65,7 +77,7 @@ public function extract( new \ArrayIterator($extract), $this->passThroughCoroutine(), $rejection, - $state + $state, ) ); } elseif ($extract instanceof \Iterator) { @@ -74,7 +86,7 @@ public function extract( $extract, $this->passThroughCoroutine(), $rejection, - $state + $state, ) ); } elseif ($extract instanceof \Traversable) { @@ -83,7 +95,7 @@ public function extract( new \IteratorIterator($extract), $this->passThroughCoroutine(), $rejection, - $state + $state, ) ); } else { @@ -93,6 +105,13 @@ public function extract( return $this; } + /** + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object + * + * @param TransformerInterface $transformer + * @param StepRejectionInterface $rejection + */ public function transform( StepCodeInterface $stepCode, TransformerInterface $transformer, @@ -135,6 +154,13 @@ public function transform( return $this; } + /** + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object + * + * @param LoaderInterface $loader + * @param StepRejectionInterface $rejection + */ public function load( StepCodeInterface $stepCode, LoaderInterface $loader, diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index 09678c7..ee57dc7 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -26,6 +26,16 @@ public function __construct( ) { } + /** + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object + * + * @param \Iterator $source + * @param \Generator|AcceptanceResultBucketInterface|RejectionResultBucketInterface|null, InputType, void> $coroutine + * @param StepRejectionInterface $rejection + * @param StepStateInterface $state + * @return \Iterator> + */ public function run( \Iterator $source, \Generator $coroutine, @@ -43,7 +53,7 @@ public function run( } if (!$bucket instanceof ResultBucketInterface) { - throw UnexpectedYieldedValueType::expectingTypes($coroutine, [ResultBucketInterface::class], $bucket); + throw UnexpectedYieldedValueType::expectingTypes($coroutine, [ResultBucketInterface::class, AcceptanceResultBucketInterface::class, RejectionResultBucketInterface::class], $bucket); } if ($bucket instanceof RejectionResultBucketInterface) { @@ -66,10 +76,6 @@ public function run( } } - if (!$bucket instanceof ResultBucketInterface) { - throw UnexpectedYieldedValueType::expectingTypes($coroutine, [ResultBucketInterface::class, AcceptanceResultBucketInterface::class, RejectionResultBucketInterface::class], $bucket); - } - if ($bucket instanceof AcceptanceResultBucketInterface) { yield from $bucket->walkAcceptance(); $state->accept(); diff --git a/src/Transformer/BatchingTransformer.php b/src/Transformer/BatchingTransformer.php index adf7791..a3aa364 100644 --- a/src/Transformer/BatchingTransformer.php +++ b/src/Transformer/BatchingTransformer.php @@ -4,35 +4,36 @@ namespace Kiboko\Component\Pipeline\Transformer; -use Kiboko\Component\Bucket\AcceptanceAppendableResultBucket; use Kiboko\Component\Bucket\AcceptanceResultBucket; -use Kiboko\Component\Bucket\AppendableIteratorAcceptanceResultBucket; use Kiboko\Component\Bucket\EmptyResultBucket; use Kiboko\Contract\Bucket\ResultBucketInterface; use Kiboko\Contract\Pipeline\FlushableInterface; use Kiboko\Contract\Pipeline\TransformerInterface; /** - * @template Type + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array * - * @implements TransformerInterface> - * @implements FlushableInterface> + * @implements TransformerInterface + * @implements FlushableInterface */ class BatchingTransformer implements TransformerInterface, FlushableInterface { - /** @var list */ + /** @var array */ private array $batch = []; + /** + * @param positive-int $batchSize + */ public function __construct( private readonly int $batchSize ) { } - /** @return \Generator>|EmptyResultBucket, Type|null, void> */ + /** @return \Generator|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { $this->batch = []; - $itemCount = 0; $line = yield new EmptyResultBucket(); /** @phpstan-ignore-next-line */ @@ -43,21 +44,24 @@ public function transform(): \Generator } $this->batch[] = $line; - if ($this->batchSize <= ++$itemCount) { + if (count($this->batch) >= $this->batchSize) { + /** @phpstan-ignore-next-line */ $line = yield new AcceptanceResultBucket($this->batch); - $itemCount = 0; $this->batch = []; - } else { - $line = yield new EmptyResultBucket(); + continue; } + + $line = yield new EmptyResultBucket(); } } + /** @return AcceptanceResultBucket|EmptyResultBucket */ public function flush(): ResultBucketInterface { if (count($this->batch) <= 0) { return new EmptyResultBucket(); } + /** @phpstan-ignore-next-line */ return new AcceptanceResultBucket($this->batch); } } diff --git a/src/Transformer/CallableTransformer.php b/src/Transformer/CallableTransformer.php index 5c469f9..f7cd6ae 100644 --- a/src/Transformer/CallableTransformer.php +++ b/src/Transformer/CallableTransformer.php @@ -9,8 +9,8 @@ use Kiboko\Contract\Pipeline\TransformerInterface; /** - * @template InputType - * @template OutputType + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object * * @template-implements TransformerInterface */ @@ -20,7 +20,7 @@ class CallableTransformer implements TransformerInterface private $callback; /** - * @param callable(InputType|null $item): OutputType $callback + * @param callable(InputType $item): OutputType $callback */ public function __construct( callable $callback, @@ -29,7 +29,7 @@ public function __construct( } /** - * @return \Generator|EmptyResultBucket, InputType|null, void> + * @return \Generator|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { @@ -38,6 +38,11 @@ public function transform(): \Generator $line = yield new EmptyResultBucket(); /** @phpstan-ignore-next-line */ while (true) { + if ($line === null) { + $line = yield new EmptyResultBucket(); + continue; + } + $line = yield new AcceptanceResultBucket($callback($line)); } } diff --git a/src/Transformer/ColumnTrimTransformer.php b/src/Transformer/ColumnTrimTransformer.php index 95490f8..c450ffe 100644 --- a/src/Transformer/ColumnTrimTransformer.php +++ b/src/Transformer/ColumnTrimTransformer.php @@ -9,7 +9,10 @@ use Kiboko\Contract\Pipeline\TransformerInterface; /** - * @template-implements TransformerInterface, non-empty-array> + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object + * + * @implements TransformerInterface */ class ColumnTrimTransformer implements TransformerInterface { @@ -19,9 +22,7 @@ public function __construct( ) { } - /** - * @return \Generator>|EmptyResultBucket, non-empty-array|null, void> - */ + /** @return \Generator|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { $line = yield new EmptyResultBucket(); @@ -38,6 +39,7 @@ public function transform(): \Generator $line[$column] = trim((string) $line[$column]); } + /** @phpstan-ignore-next-line */ $line = yield new AcceptanceResultBucket($line); } } diff --git a/src/Transformer/FilterTransformer.php b/src/Transformer/FilterTransformer.php index 8f6d082..a92d66e 100644 --- a/src/Transformer/FilterTransformer.php +++ b/src/Transformer/FilterTransformer.php @@ -9,18 +9,16 @@ use Kiboko\Contract\Pipeline\TransformerInterface; /** - * @template Type + * @template Type of non-empty-array|object * - * @template-implements TransformerInterface + * @implements TransformerInterface */ class FilterTransformer implements TransformerInterface { /** @var callable(Type $item): bool */ private $callback; - /** - * @param callable(Type $item): bool $callback - */ + /** @param callable(Type $item): bool $callback */ public function __construct( callable $callback, ) { @@ -28,7 +26,7 @@ public function __construct( } /** - * @return \Generator|EmptyResultBucket, Type|null, void> + * @return \Generator|EmptyResultBucket, Type|null, void> */ public function transform(): \Generator { diff --git a/src/UnexpectedYieldedValueType.php b/src/UnexpectedYieldedValueType.php index cc896ee..0c4ad30 100644 --- a/src/UnexpectedYieldedValueType.php +++ b/src/UnexpectedYieldedValueType.php @@ -7,8 +7,8 @@ use Kiboko\Contract\Bucket\ResultBucketInterface; /** - * @template InputType - * @template OutputType + * @template InputType of non-empty-array|object + * @template OutputType of non-empty-array|object */ final class UnexpectedYieldedValueType extends \UnexpectedValueException { @@ -27,9 +27,10 @@ public function getCoroutine(): \Generator } /** - * @param \Generator, InputType|null, void> $actual + * @param \Generator, InputType, void> $actual * @param list $expectedTypes * @param mixed $actual + * * @return UnexpectedYieldedValueType */ public static function expectingTypes(\Generator $coroutine, array $expectedTypes, $actual, int $code = 0, ?\Throwable $previous = null): self @@ -47,6 +48,7 @@ public static function expectingTypes(\Generator $coroutine, array $expectedType $executionFile = $re->getExecutingFile(); $executionLine = $re->getExecutingLine(); + /** @phpstan-ignore-next-line */ return new self( $coroutine, strtr( @@ -63,6 +65,7 @@ public static function expectingTypes(\Generator $coroutine, array $expectedType $previous ); } catch (\ReflectionException) { + /** @phpstan-ignore-next-line */ return new self( $coroutine, strtr( From 2d03f6b25fac3c417e9c04d78111c9586ffad9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 14 Nov 2023 14:28:02 +0100 Subject: [PATCH 07/10] Fixing PHPStan level 4 issues --- .github/workflows/quality.yaml | 2 +- composer.lock | 8 ++++---- src/GeneratorWrapper.php | 8 ++++---- src/Loader/LogLoader.php | 2 +- src/Loader/StreamLoader.php | 2 +- src/Pipeline.php | 4 ++-- src/PipelineRunner.php | 6 +++--- src/Transformer/BatchingTransformer.php | 4 ++-- src/Transformer/CallableTransformer.php | 2 +- src/Transformer/ColumnTrimTransformer.php | 2 +- src/Transformer/FilterTransformer.php | 2 +- src/UnexpectedYieldedValueType.php | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index b8f4078..ad20fd5 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -33,5 +33,5 @@ jobs: uses: php-actions/phpstan@v3 with: path: src/ - level: 3 + level: 4 php_version: '8.2' diff --git a/composer.lock b/composer.lock index 2121a79..2fba402 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/php-etl/bucket.git", - "reference": "96b2549417b603abdee3f193d7d3074c0672f45a" + "reference": "3e25f9ca7a85c7c05a72c004407f13da501248c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/bucket/zipball/96b2549417b603abdee3f193d7d3074c0672f45a", - "reference": "96b2549417b603abdee3f193d7d3074c0672f45a", + "url": "https://api.github.com/repos/php-etl/bucket/zipball/3e25f9ca7a85c7c05a72c004407f13da501248c0", + "reference": "3e25f9ca7a85c7c05a72c004407f13da501248c0", "shasum": "" }, "require": { @@ -61,7 +61,7 @@ "issues": "https://github.com/php-etl/bucket/issues", "source": "https://github.com/php-etl/bucket/tree/main" }, - "time": "2023-11-14T10:16:20+00:00" + "time": "2023-11-14T11:38:59+00:00" }, { "name": "php-etl/bucket-contracts", diff --git a/src/GeneratorWrapper.php b/src/GeneratorWrapper.php index f662c69..95856f3 100644 --- a/src/GeneratorWrapper.php +++ b/src/GeneratorWrapper.php @@ -11,7 +11,7 @@ */ class GeneratorWrapper { - /** @param \Iterator ...$iterators */ + /** @param \Iterator, Type> ...$iterators */ public function rewind(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -19,7 +19,7 @@ public function rewind(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator, Type> ...$iterators */ public function next(\Iterator ...$iterators): void { foreach ($iterators as $iterator) { @@ -27,7 +27,7 @@ public function next(\Iterator ...$iterators): void } } - /** @param \Iterator ...$iterators */ + /** @param \Iterator, Type> ...$iterators */ public function valid(\Iterator ...$iterators): bool { foreach ($iterators as $iterator) { @@ -41,7 +41,7 @@ public function valid(\Iterator ...$iterators): bool /** * @param Type $value - * @param \Generator, Type, void> ...$generators + * @param \Generator, ResultBucketInterface, Type, void> ...$generators */ public function send($value, \Generator ...$generators): \Generator { diff --git a/src/Loader/LogLoader.php b/src/Loader/LogLoader.php index 02ef5c7..23fb3eb 100644 --- a/src/Loader/LogLoader.php +++ b/src/Loader/LogLoader.php @@ -21,7 +21,7 @@ public function __construct(private LoggerInterface $logger, private string $log { } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** @return \Generator, AcceptanceResultBucket|EmptyResultBucket, Type|null, void> */ public function load(): \Generator { $line = yield new EmptyResultBucket(); diff --git a/src/Loader/StreamLoader.php b/src/Loader/StreamLoader.php index fd98b6e..1b3792a 100644 --- a/src/Loader/StreamLoader.php +++ b/src/Loader/StreamLoader.php @@ -28,7 +28,7 @@ public function __construct($stream) $this->stream = $stream; } - /** @return \Generator|EmptyResultBucket, Type|null, void> */ + /** @return \Generator, AcceptanceResultBucket|EmptyResultBucket, Type|null, void> */ public function load(): \Generator { $line = yield new EmptyResultBucket(); diff --git a/src/Pipeline.php b/src/Pipeline.php index be37897..9b33007 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -22,9 +22,9 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterface { - /** @var \AppendIterator|object, \Iterator|object>> */ + /** @var \AppendIterator, non-empty-array|object, \Iterator, non-empty-array|object>> */ private readonly \AppendIterator $source; - /** @var \Iterator|object>|\NoRewindIterator */ + /** @var \Iterator, non-empty-array|object>|\NoRewindIterator */ private iterable $subject; public function __construct( diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index ee57dc7..9862d08 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -30,11 +30,11 @@ public function __construct( * @template InputType of non-empty-array|object * @template OutputType of non-empty-array|object * - * @param \Iterator $source - * @param \Generator|AcceptanceResultBucketInterface|RejectionResultBucketInterface|null, InputType, void> $coroutine + * @param \Iterator, InputType|null> $source + * @param \Generator, ResultBucketInterface|AcceptanceResultBucketInterface|RejectionResultBucketInterface|null, InputType, void> $coroutine * @param StepRejectionInterface $rejection * @param StepStateInterface $state - * @return \Iterator> + * @return \Iterator, ResultBucketInterface> */ public function run( \Iterator $source, diff --git a/src/Transformer/BatchingTransformer.php b/src/Transformer/BatchingTransformer.php index a3aa364..c404127 100644 --- a/src/Transformer/BatchingTransformer.php +++ b/src/Transformer/BatchingTransformer.php @@ -19,7 +19,7 @@ */ class BatchingTransformer implements TransformerInterface, FlushableInterface { - /** @var array */ + /** @var list */ private array $batch = []; /** @@ -30,7 +30,7 @@ public function __construct( ) { } - /** @return \Generator|EmptyResultBucket, InputType|null, void> */ + /** @return \Generator, ResultBucketInterface|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { $this->batch = []; diff --git a/src/Transformer/CallableTransformer.php b/src/Transformer/CallableTransformer.php index f7cd6ae..c3ac523 100644 --- a/src/Transformer/CallableTransformer.php +++ b/src/Transformer/CallableTransformer.php @@ -29,7 +29,7 @@ public function __construct( } /** - * @return \Generator|EmptyResultBucket, InputType|null, void> + * @return \Generator, AcceptanceResultBucket|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { diff --git a/src/Transformer/ColumnTrimTransformer.php b/src/Transformer/ColumnTrimTransformer.php index c450ffe..23b500a 100644 --- a/src/Transformer/ColumnTrimTransformer.php +++ b/src/Transformer/ColumnTrimTransformer.php @@ -22,7 +22,7 @@ public function __construct( ) { } - /** @return \Generator|EmptyResultBucket, InputType|null, void> */ + /** @return \Generator, AcceptanceResultBucket|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { $line = yield new EmptyResultBucket(); diff --git a/src/Transformer/FilterTransformer.php b/src/Transformer/FilterTransformer.php index a92d66e..b10c112 100644 --- a/src/Transformer/FilterTransformer.php +++ b/src/Transformer/FilterTransformer.php @@ -26,7 +26,7 @@ public function __construct( } /** - * @return \Generator|EmptyResultBucket, Type|null, void> + * @return \Generator, AcceptanceResultBucket|EmptyResultBucket, Type|null, void> */ public function transform(): \Generator { diff --git a/src/UnexpectedYieldedValueType.php b/src/UnexpectedYieldedValueType.php index 0c4ad30..f4c9ba7 100644 --- a/src/UnexpectedYieldedValueType.php +++ b/src/UnexpectedYieldedValueType.php @@ -27,7 +27,7 @@ public function getCoroutine(): \Generator } /** - * @param \Generator, InputType, void> $actual + * @param \Generator, ResultBucketInterface, InputType, void> $actual * @param list $expectedTypes * @param mixed $actual * From 3d39e7b6047d048ae52266f2cb5bd434b375a64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 14 Nov 2023 14:28:45 +0100 Subject: [PATCH 08/10] Fixing PHPStan level 4 issues --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 2fba402..4e311f3 100644 --- a/composer.lock +++ b/composer.lock @@ -124,12 +124,12 @@ "source": { "type": "git", "url": "https://github.com/php-etl/pipeline-contracts.git", - "reference": "18f75049a19c137ba46c8b7d10dce4e4a502cf39" + "reference": "224cf14efe07df6ccd5d2b35eb7fba3bad7823c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/18f75049a19c137ba46c8b7d10dce4e4a502cf39", - "reference": "18f75049a19c137ba46c8b7d10dce4e4a502cf39", + "url": "https://api.github.com/repos/php-etl/pipeline-contracts/zipball/224cf14efe07df6ccd5d2b35eb7fba3bad7823c0", + "reference": "224cf14efe07df6ccd5d2b35eb7fba3bad7823c0", "shasum": "" }, "require": { @@ -173,7 +173,7 @@ "issues": "https://github.com/php-etl/pipeline-contracts/issues", "source": "https://github.com/php-etl/pipeline-contracts/tree/main" }, - "time": "2023-11-14T10:45:05+00:00" + "time": "2023-11-14T13:28:21+00:00" }, { "name": "php-etl/satellite-contracts", From d1e6ba2d0b478ca19f1e7fc2ae5bd5b38faaf2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 14 Nov 2023 14:33:24 +0100 Subject: [PATCH 09/10] Fixing PHPStan level 4 issues --- .github/workflows/quality.yaml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index ad20fd5..81521af 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -1,4 +1,4 @@ -name: Quality (PHPStan level 3) +name: Quality (PHPStan level 4) on: push jobs: cs-fixer: diff --git a/README.md b/README.md index 0a2c286..d28acef 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This package brings an implementation for the pipeline component, aimed at provi with logging, line rejections and execution states. -[![Quality](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml) +[![Quality (PHPStan level 4)](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/quality.yaml) [![PHPUnit](https://github.com/php-etl/pipeline/actions/workflows/phpunit.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpunit.yaml) [![Mutations](https://github.com/php-etl/pipeline/actions/workflows/infection.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/infection.yaml) [![PHPStan level 5](https://github.com/php-etl/pipeline/actions/workflows/phpstan-5.yaml/badge.svg)](https://github.com/php-etl/pipeline/actions/workflows/phpstan-5.yaml) From e61319bd9fbbb64b51b0ec8ff360f86d5dccf501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 14 Nov 2023 14:34:44 +0100 Subject: [PATCH 10/10] CS Fixing classes --- src/Extractor/ArrayExtractor.php | 5 ++--- src/Extractor/IteratorExtractor.php | 5 ++--- src/GeneratorWrapper.php | 2 +- src/Loader/LogLoader.php | 8 +++----- src/Loader/StreamLoader.php | 5 ++--- src/Pipeline.php | 11 +++++------ src/PipelineRunner.php | 17 ++++++----------- src/StepCode.php | 3 +-- src/Transformer/BatchingTransformer.php | 14 +++++++------- src/Transformer/CallableTransformer.php | 6 +++--- src/Transformer/ColumnTrimTransformer.php | 5 ++--- src/Transformer/FilterTransformer.php | 4 ++-- src/UnexpectedYieldedValueType.php | 11 +++++------ 13 files changed, 41 insertions(+), 55 deletions(-) diff --git a/src/Extractor/ArrayExtractor.php b/src/Extractor/ArrayExtractor.php index c6c71cc..e34d088 100644 --- a/src/Extractor/ArrayExtractor.php +++ b/src/Extractor/ArrayExtractor.php @@ -8,14 +8,13 @@ /** * @template Type of non-empty-array|object + * * @implements ExtractorInterface */ class ArrayExtractor implements ExtractorInterface { /** @param non-empty-array $data */ - public function __construct(private readonly array $data) - { - } + public function __construct(private readonly array $data) {} /** * @return \Generator diff --git a/src/Extractor/IteratorExtractor.php b/src/Extractor/IteratorExtractor.php index 46cf7ec..332a85c 100644 --- a/src/Extractor/IteratorExtractor.php +++ b/src/Extractor/IteratorExtractor.php @@ -8,14 +8,13 @@ /** * @template Type of non-empty-array|object + * * @implements ExtractorInterface */ class IteratorExtractor implements ExtractorInterface { /** @param \Traversable $traversable */ - public function __construct(private readonly \Traversable $traversable) - { - } + public function __construct(private readonly \Traversable $traversable) {} /** * @return \Generator diff --git a/src/GeneratorWrapper.php b/src/GeneratorWrapper.php index 95856f3..1508d95 100644 --- a/src/GeneratorWrapper.php +++ b/src/GeneratorWrapper.php @@ -40,7 +40,7 @@ public function valid(\Iterator ...$iterators): bool } /** - * @param Type $value + * @param Type $value * @param \Generator, ResultBucketInterface, Type, void> ...$generators */ public function send($value, \Generator ...$generators): \Generator diff --git a/src/Loader/LogLoader.php b/src/Loader/LogLoader.php index 23fb3eb..a5f8700 100644 --- a/src/Loader/LogLoader.php +++ b/src/Loader/LogLoader.php @@ -17,17 +17,15 @@ */ final readonly class LogLoader implements LoaderInterface { - public function __construct(private LoggerInterface $logger, private string $logLevel = LogLevel::DEBUG) - { - } + public function __construct(private LoggerInterface $logger, private string $logLevel = LogLevel::DEBUG) {} /** @return \Generator, AcceptanceResultBucket|EmptyResultBucket, Type|null, void> */ public function load(): \Generator { $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { - if ($line === null) { + if (null === $line) { $line = yield new EmptyResultBucket(); continue; } diff --git a/src/Loader/StreamLoader.php b/src/Loader/StreamLoader.php index 1b3792a..8bdca13 100644 --- a/src/Loader/StreamLoader.php +++ b/src/Loader/StreamLoader.php @@ -32,9 +32,9 @@ public function __construct($stream) public function load(): \Generator { $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { - if ($line === null) { + if (null === $line) { $line = yield new EmptyResultBucket(); continue; } @@ -46,7 +46,6 @@ public function load(): \Generator /** * @param Type|null $line - * @return string */ abstract protected function formatLine(mixed $line): string; } diff --git a/src/Pipeline.php b/src/Pipeline.php index 9b33007..d823fe7 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -30,7 +30,7 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterfac public function __construct( private readonly PipelineRunnerInterface $runner, private readonly StateInterface $state, - ?\Iterator $source = null + \Iterator $source = null ) { $this->source = new \AppendIterator(); $this->source->append($source ?? new \EmptyIterator()); @@ -42,7 +42,6 @@ public function __construct( * @template InputType of non-empty-array|object * * @param InputType ...$data - * @return void */ public function feed(...$data): void { @@ -52,7 +51,7 @@ public function feed(...$data): void private function passThroughCoroutine(): \Generator { $line = yield; - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { $line = yield $line; } @@ -61,7 +60,7 @@ private function passThroughCoroutine(): \Generator /** * @template Type of non-empty-array|object * - * @param ExtractorInterface $extractor + * @param ExtractorInterface $extractor * @param StepRejectionInterface $rejection */ public function extract( @@ -110,7 +109,7 @@ public function extract( * @template OutputType of non-empty-array|object * * @param TransformerInterface $transformer - * @param StepRejectionInterface $rejection + * @param StepRejectionInterface $rejection */ public function transform( StepCodeInterface $stepCode, @@ -159,7 +158,7 @@ public function transform( * @template OutputType of non-empty-array|object * * @param LoaderInterface $loader - * @param StepRejectionInterface $rejection + * @param StepRejectionInterface $rejection */ public function load( StepCodeInterface $stepCode, diff --git a/src/PipelineRunner.php b/src/PipelineRunner.php index 9862d08..283ce21 100644 --- a/src/PipelineRunner.php +++ b/src/PipelineRunner.php @@ -4,14 +4,10 @@ namespace Kiboko\Component\Pipeline; -use Kiboko\Component\Bucket\RejectionResultBucket; -use Kiboko\Component\Bucket\RejectionWithReasonResultBucket; use Kiboko\Contract\Bucket\AcceptanceResultBucketInterface; use Kiboko\Contract\Bucket\RejectionResultBucketInterface; use Kiboko\Contract\Bucket\ResultBucketInterface; use Kiboko\Contract\Pipeline\PipelineRunnerInterface; -use Kiboko\Contract\Pipeline\RejectionInterface; -use Kiboko\Contract\Pipeline\StateInterface; use Kiboko\Contract\Pipeline\StepRejectionInterface; use Kiboko\Contract\Pipeline\StepStateInterface; use Psr\Log\LoggerInterface; @@ -23,17 +19,16 @@ class PipelineRunner implements PipelineRunnerInterface public function __construct( private readonly LoggerInterface $logger = new NullLogger(), private readonly LogLevel|string $rejectionLevel = LogLevel::WARNING - ) { - } + ) {} /** * @template InputType of non-empty-array|object * @template OutputType of non-empty-array|object * - * @param \Iterator, InputType|null> $source + * @param \Iterator, InputType|null> $source * @param \Generator, ResultBucketInterface|AcceptanceResultBucketInterface|RejectionResultBucketInterface|null, InputType, void> $coroutine - * @param StepRejectionInterface $rejection - * @param StepStateInterface $state + * @param StepRejectionInterface $rejection + * * @return \Iterator, ResultBucketInterface> */ public function run( @@ -59,8 +54,8 @@ public function run( if ($bucket instanceof RejectionResultBucketInterface) { $reasons = $bucket->reasons(); foreach ($bucket->walkRejection() as $line) { - if ($reasons !== null) { - $rejection->rejectWithReason($line, implode(PHP_EOL, $reasons)); + if (null !== $reasons) { + $rejection->rejectWithReason($line, implode(\PHP_EOL, $reasons)); } else { $rejection->reject($line); } diff --git a/src/StepCode.php b/src/StepCode.php index ac1dfd7..2f019be 100644 --- a/src/StepCode.php +++ b/src/StepCode.php @@ -10,8 +10,7 @@ { private function __construct( private string $reference, - ) { - } + ) {} public static function fromString(string $reference): self { diff --git a/src/Transformer/BatchingTransformer.php b/src/Transformer/BatchingTransformer.php index c404127..7764ddd 100644 --- a/src/Transformer/BatchingTransformer.php +++ b/src/Transformer/BatchingTransformer.php @@ -27,8 +27,7 @@ class BatchingTransformer implements TransformerInterface, FlushableInterface */ public function __construct( private readonly int $batchSize - ) { - } + ) {} /** @return \Generator, ResultBucketInterface|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator @@ -36,15 +35,15 @@ public function transform(): \Generator $this->batch = []; $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { - if ($line === null) { + if (null === $line) { $line = yield new EmptyResultBucket(); continue; } $this->batch[] = $line; - if (count($this->batch) >= $this->batchSize) { + if (\count($this->batch) >= $this->batchSize) { /** @phpstan-ignore-next-line */ $line = yield new AcceptanceResultBucket($this->batch); $this->batch = []; @@ -58,10 +57,11 @@ public function transform(): \Generator /** @return AcceptanceResultBucket|EmptyResultBucket */ public function flush(): ResultBucketInterface { - if (count($this->batch) <= 0) { + if (\count($this->batch) <= 0) { return new EmptyResultBucket(); } - /** @phpstan-ignore-next-line */ + + /* @phpstan-ignore-next-line */ return new AcceptanceResultBucket($this->batch); } } diff --git a/src/Transformer/CallableTransformer.php b/src/Transformer/CallableTransformer.php index c3ac523..fc78bd6 100644 --- a/src/Transformer/CallableTransformer.php +++ b/src/Transformer/CallableTransformer.php @@ -16,7 +16,7 @@ */ class CallableTransformer implements TransformerInterface { - /** @var callable(InputType|null $item): OutputType */ + /** @var callable(InputType|null): OutputType */ private $callback; /** @@ -36,9 +36,9 @@ public function transform(): \Generator $callback = $this->callback; $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { - if ($line === null) { + if (null === $line) { $line = yield new EmptyResultBucket(); continue; } diff --git a/src/Transformer/ColumnTrimTransformer.php b/src/Transformer/ColumnTrimTransformer.php index 23b500a..1abe117 100644 --- a/src/Transformer/ColumnTrimTransformer.php +++ b/src/Transformer/ColumnTrimTransformer.php @@ -19,14 +19,13 @@ class ColumnTrimTransformer implements TransformerInterface /** @param list $columnsToTrim */ public function __construct( private readonly array $columnsToTrim - ) { - } + ) {} /** @return \Generator, AcceptanceResultBucket|EmptyResultBucket, InputType|null, void> */ public function transform(): \Generator { $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { if (null === $line) { $line = yield new EmptyResultBucket(); diff --git a/src/Transformer/FilterTransformer.php b/src/Transformer/FilterTransformer.php index b10c112..c39174c 100644 --- a/src/Transformer/FilterTransformer.php +++ b/src/Transformer/FilterTransformer.php @@ -15,7 +15,7 @@ */ class FilterTransformer implements TransformerInterface { - /** @var callable(Type $item): bool */ + /** @var callable(Type): bool */ private $callback; /** @param callable(Type $item): bool $callback */ @@ -33,7 +33,7 @@ public function transform(): \Generator $callback = $this->callback; $line = yield new EmptyResultBucket(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ while (true) { if (null === $line || !$callback($line)) { $line = yield new EmptyResultBucket(); diff --git a/src/UnexpectedYieldedValueType.php b/src/UnexpectedYieldedValueType.php index f4c9ba7..acb83c8 100644 --- a/src/UnexpectedYieldedValueType.php +++ b/src/UnexpectedYieldedValueType.php @@ -16,7 +16,7 @@ public function __construct( private readonly \Generator $coroutine, string $message = '', int $code = 0, - ?\Throwable $previous = null + \Throwable $previous = null ) { parent::__construct($message, $code, $previous); } @@ -28,12 +28,11 @@ public function getCoroutine(): \Generator /** * @param \Generator, ResultBucketInterface, InputType, void> $actual - * @param list $expectedTypes - * @param mixed $actual + * @param list $expectedTypes * * @return UnexpectedYieldedValueType */ - public static function expectingTypes(\Generator $coroutine, array $expectedTypes, $actual, int $code = 0, ?\Throwable $previous = null): self + public static function expectingTypes(\Generator $coroutine, array $expectedTypes, $actual, int $code = 0, \Throwable $previous = null): self { try { $re = new \ReflectionGenerator($coroutine); @@ -48,7 +47,7 @@ public static function expectingTypes(\Generator $coroutine, array $expectedType $executionFile = $re->getExecutingFile(); $executionLine = $re->getExecutingLine(); - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ return new self( $coroutine, strtr( @@ -65,7 +64,7 @@ public static function expectingTypes(\Generator $coroutine, array $expectedType $previous ); } catch (\ReflectionException) { - /** @phpstan-ignore-next-line */ + /* @phpstan-ignore-next-line */ return new self( $coroutine, strtr(