Skip to content

Commit 141ef98

Browse files
committed
Fixing PHPStan level 9 issues
1 parent 000076d commit 141ef98

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

src/GeneratorWrapper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
*/
1212
class GeneratorWrapper
1313
{
14-
/** @param \Iterator<mixed, mixed> ...$iterators */
14+
/** @param \Iterator<array-key, Type> ...$iterators */
1515
public function rewind(\Iterator ...$iterators): void
1616
{
1717
foreach ($iterators as $iterator) {
1818
$iterator->rewind();
1919
}
2020
}
2121

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

30-
/** @param \Iterator<mixed, mixed> ...$iterators */
30+
/** @param \Iterator<array-key, 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|null, void> ...$generators
44+
* @param \Generator<array-key, ResultBucketInterface<Type>, Type, void> ...$generators
4545
*/
4646
public function send($value, \Generator ...$generators): \Generator
4747
{

src/Pipeline.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ class Pipeline implements PipelineInterface, WalkableInterface, RunnableInterfac
2727
/** @var iterable<mixed>|\NoRewindIterator */
2828
private iterable $subject;
2929

30-
/**
31-
* @param PipelineRunnerInterface<mixed> $runner
32-
*/
3330
public function __construct(
3431
private readonly PipelineRunnerInterface $runner,
3532
private readonly StateInterface $state,
@@ -49,6 +46,7 @@ public function feed(...$data): void
4946
private function passThroughCoroutine(): \Generator
5047
{
5148
$line = yield;
49+
/** @phpstan-ignore-next-line */
5250
while (true) {
5351
$line = yield $line;
5452
}

src/PipelineRunner.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
use Psr\Log\LogLevel;
1919
use Psr\Log\NullLogger;
2020

21-
/**
22-
* @template Type
23-
*
24-
* @implements PipelineRunnerInterface<Type>
25-
*/
2621
class PipelineRunner implements PipelineRunnerInterface
2722
{
2823
public function __construct(
@@ -52,9 +47,13 @@ public function run(
5247
}
5348

5449
if ($bucket instanceof RejectionResultBucketInterface) {
50+
$reasons = $bucket->reasons();
5551
foreach ($bucket->walkRejection() as $line) {
56-
$rejection->reject($line);
57-
$rejection->rejectWithReason($line, implode('', $bucket->reasons()));
52+
if ($reasons !== null) {
53+
$rejection->rejectWithReason($line, implode(PHP_EOL, $reasons));
54+
} else {
55+
$rejection->reject($line);
56+
}
5857
$state->reject();
5958

6059
$this->logger->log(

0 commit comments

Comments
 (0)