Skip to content

Commit f5f87d2

Browse files
committed
Fixing PHPStan level 4 issues
1 parent 141ef98 commit f5f87d2

18 files changed

+139
-84
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"php": "^8.2",
2020
"psr/log": "^3.0",
2121
"php-etl/bucket": "*",
22-
"php-etl/pipeline-contracts": "0.5.*",
23-
"php-etl/bucket-contracts": "0.2.*"
22+
"php-etl/pipeline-contracts": "0.5.*"
2423
},
2524
"require-dev": {
2625
"phpunit/php-invoker": "^4.0",

composer.lock

Lines changed: 29 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Extractor/ArrayExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Kiboko\Contract\Pipeline\ExtractorInterface;
88

99
/**
10-
* @template Type
10+
* @template Type of non-empty-array<array-key, mixed>|object
1111
* @implements ExtractorInterface<Type>
1212
*/
1313
class ArrayExtractor implements ExtractorInterface

src/Extractor/IteratorExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Kiboko\Contract\Pipeline\ExtractorInterface;
88

99
/**
10-
* @template Type
10+
* @template Type of non-empty-array<array-key, mixed>|object
1111
* @implements ExtractorInterface<Type>
1212
*/
1313
class IteratorExtractor implements ExtractorInterface

src/GeneratorWrapper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77
use Kiboko\Contract\Bucket\ResultBucketInterface;
88

99
/**
10-
* @template Type
10+
* @template Type of non-empty-array<array-key, mixed>|object
1111
*/
1212
class GeneratorWrapper
1313
{
14-
/** @param \Iterator<array-key, Type> ...$iterators */
14+
/** @param \Iterator<positive-int, Type> ...$iterators */
1515
public function rewind(\Iterator ...$iterators): void
1616
{
1717
foreach ($iterators as $iterator) {
1818
$iterator->rewind();
1919
}
2020
}
2121

22-
/** @param \Iterator<array-key, Type> ...$iterators */
22+
/** @param \Iterator<positive-int, Type> ...$iterators */
2323
public function next(\Iterator ...$iterators): void
2424
{
2525
foreach ($iterators as $iterator) {
2626
$iterator->next();
2727
}
2828
}
2929

30-
/** @param \Iterator<array-key, Type> ...$iterators */
30+
/** @param \Iterator<positive-int, Type> ...$iterators */
3131
public function valid(\Iterator ...$iterators): bool
3232
{
3333
foreach ($iterators as $iterator) {
@@ -41,7 +41,7 @@ public function valid(\Iterator ...$iterators): bool
4141

4242
/**
4343
* @param Type $value
44-
* @param \Generator<array-key, ResultBucketInterface<Type>, Type, void> ...$generators
44+
* @param \Generator<positive-int, ResultBucketInterface<Type>, Type, void> ...$generators
4545
*/
4646
public function send($value, \Generator ...$generators): \Generator
4747
{

src/Loader/DebugLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Kiboko\Component\Pipeline\Loader;
66

77
/**
8-
* @template Type
8+
* @template Type of non-empty-array<array-key, mixed>|object
99
*
1010
* @extends StreamLoader<Type>
1111
*/

src/Loader/JSONStreamLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Kiboko\Component\Pipeline\Loader;
66

77
/**
8-
* @template Type
8+
* @template Type of non-empty-array<array-key, mixed>|object
99
*
1010
* @extends StreamLoader<Type>
1111
*/

src/Loader/LogLoader.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Psr\Log\LogLevel;
1212

1313
/**
14-
* @template Type
14+
* @template Type of non-empty-array<array-key, mixed>|object
1515
*
1616
* @implements LoaderInterface<Type, Type>
1717
*/
@@ -21,12 +21,17 @@ public function __construct(private LoggerInterface $logger, private string $log
2121
{
2222
}
2323

24-
/** @return \Generator<mixed, AcceptanceResultBucket<Type|null>|EmptyResultBucket, Type|null, void> */
24+
/** @return \Generator<positive-int, AcceptanceResultBucket<Type>|EmptyResultBucket, Type|null, void> */
2525
public function load(): \Generator
2626
{
2727
$line = yield new EmptyResultBucket();
2828
/** @phpstan-ignore-next-line */
2929
while (true) {
30+
if ($line === null) {
31+
$line = yield new EmptyResultBucket();
32+
continue;
33+
}
34+
3035
$this->logger->log($this->logLevel, var_export($line, true));
3136
$line = yield new AcceptanceResultBucket($line);
3237
}

src/Loader/StderrLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Kiboko\Component\Pipeline\Loader;
66

77
/**
8-
* @template Type
8+
* @template Type of non-empty-array<array-key, mixed>|object
99
*
1010
* @extends StreamLoader<Type>
1111
*/

src/Loader/StdoutLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Kiboko\Component\Pipeline\Loader;
66

77
/**
8-
* @template Type
8+
* @template Type of non-empty-array<array-key, mixed>|object
99
*
1010
* @extends StreamLoader<Type>
1111
*/

0 commit comments

Comments
 (0)