Skip to content

Commit

Permalink
Fixing PHPStan level 9 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gplanchat committed Nov 14, 2023
1 parent e61319b commit bbc5991
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 68 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Extractor/ArrayExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Kiboko\Contract\Pipeline\ExtractorInterface;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @implements ExtractorInterface<Type>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Extractor/IteratorExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Kiboko\Contract\Pipeline\ExtractorInterface;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @implements ExtractorInterface<Type>
*/
Expand Down
4 changes: 2 additions & 2 deletions src/GeneratorWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Kiboko\Contract\Bucket\ResultBucketInterface;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*/
class GeneratorWrapper
{
Expand Down Expand Up @@ -41,7 +41,7 @@ public function valid(\Iterator ...$iterators): bool

/**
* @param Type $value
* @param \Generator<int<0, max>, ResultBucketInterface<Type>, Type, void> ...$generators
* @param \Generator<int, ResultBucketInterface<Type>, Type, void> ...$generators
*/
public function send($value, \Generator ...$generators): \Generator

Check failure on line 46 in src/GeneratorWrapper.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @param for parameter $generators is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 46 in src/GeneratorWrapper.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @param for parameter $generators is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 46 in src/GeneratorWrapper.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @param for parameter $generators is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 46 in src/GeneratorWrapper.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @param for parameter $generators is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 46 in src/GeneratorWrapper.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @param for parameter $generators is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.
{
Expand Down
2 changes: 1 addition & 1 deletion src/Loader/DebugLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Kiboko\Component\Pipeline\Loader;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @extends StreamLoader<Type>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Loader/JSONStreamLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Kiboko\Component\Pipeline\Loader;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @extends StreamLoader<Type>
*/
Expand Down
17 changes: 12 additions & 5 deletions src/Loader/LogLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,39 @@

use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @implements LoaderInterface<Type, Type>
*/
final readonly class LogLoader implements LoaderInterface

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type InputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type OutputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type InputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type OutputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type InputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type OutputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type InputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type OutputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type InputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.

Check failure on line 19 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Pipeline\LoaderInterface<mixed, mixed> in PHPDoc tag @implements is not subtype of template type OutputType of array|object of interface Kiboko\Contract\Pipeline\LoaderInterface.
{
public function __construct(private LoggerInterface $logger, private string $logLevel = LogLevel::DEBUG) {}

/** @return \Generator<int<0, max>, AcceptanceResultBucket<Type>|EmptyResultBucket, Type|null, void> */
/** @return \Generator<int, ResultBucketInterface<Type>, Type|null, void> */
public function load(): \Generator

Check failure on line 24 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @return is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 24 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @return is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 24 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @return is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 24 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @return is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.

Check failure on line 24 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Contract\Bucket\ResultBucketInterface<mixed> in PHPDoc tag @return is not subtype of template type Type of array|object of interface Kiboko\Contract\Bucket\ResultBucketInterface.
{
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<Type> $bucket */
$bucket = new EmptyResultBucket();

Check failure on line 27 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 27 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 27 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 27 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 27 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.
$line = yield $bucket;
/* @phpstan-ignore-next-line */
while (true) {
if (null === $line) {
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<Type> $bucket */
$bucket = new EmptyResultBucket();

Check failure on line 33 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 33 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 33 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 33 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.

Check failure on line 33 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\EmptyResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\EmptyResultBucket.
$line = yield $bucket;
continue;
}

$this->logger->log($this->logLevel, var_export($line, true));
$line = yield new AcceptanceResultBucket($line);
/** @var AcceptanceResultBucket<Type> $bucket */
$bucket = new AcceptanceResultBucket($line);

Check failure on line 40 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\AcceptanceResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\AcceptanceResultBucket.

Check failure on line 40 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\AcceptanceResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\AcceptanceResultBucket.

Check failure on line 40 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\AcceptanceResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\AcceptanceResultBucket.

Check failure on line 40 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\AcceptanceResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\AcceptanceResultBucket.

Check failure on line 40 in src/Loader/LogLoader.php

View workflow job for this annotation

GitHub Actions / phpstan

Type mixed in generic type Kiboko\Component\Bucket\AcceptanceResultBucket<mixed> in PHPDoc tag @var for variable $bucket is not subtype of template type Type of array|object of class Kiboko\Component\Bucket\AcceptanceResultBucket.
$line = yield $bucket;
}
}
}
2 changes: 1 addition & 1 deletion src/Loader/StderrLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Kiboko\Component\Pipeline\Loader;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @extends StreamLoader<Type>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Loader/StdoutLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Kiboko\Component\Pipeline\Loader;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @extends StreamLoader<Type>
*/
Expand Down
17 changes: 12 additions & 5 deletions src/Loader/StreamLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\LoaderInterface;

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @implements LoaderInterface<Type, Type>
*/
Expand All @@ -28,19 +29,25 @@ public function __construct($stream)
$this->stream = $stream;
}

/** @return \Generator<int<0, max>, AcceptanceResultBucket<Type>|EmptyResultBucket, Type|null, void> */
/** @return \Generator<int, ResultBucketInterface<Type>, Type|null, void> */
public function load(): \Generator
{
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<Type> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
/* @phpstan-ignore-next-line */
while (true) {
if (null === $line) {
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<Type> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
continue;
}

fwrite($this->stream, $this->formatLine($line));
$line = yield new AcceptanceResultBucket($line);
/** @var AcceptanceResultBucket<Type> $bucket */
$bucket = new AcceptanceResultBucket($line);
$line = yield $bucket;
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
}

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template InputType
*
* @param InputType ...$data
*/
Expand All @@ -58,7 +58,7 @@ private function passThroughCoroutine(): \Generator
}

/**
* @template Type of non-empty-array<array-key, mixed>|object
* @template Type
*
* @param ExtractorInterface<Type> $extractor
* @param StepRejectionInterface<Type> $rejection
Expand Down Expand Up @@ -105,8 +105,8 @@ public function extract(
}

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template OutputType of non-empty-array<array-key, mixed>|object
* @template InputType
* @template OutputType
*
* @param TransformerInterface<InputType, OutputType> $transformer
* @param StepRejectionInterface<InputType> $rejection
Expand Down Expand Up @@ -154,8 +154,8 @@ public function transform(
}

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template OutputType of non-empty-array<array-key, mixed>|object
* @template InputType
* @template OutputType
*
* @param LoaderInterface<InputType, OutputType> $loader
* @param StepRejectionInterface<InputType> $rejection
Expand Down
6 changes: 3 additions & 3 deletions src/PipelineRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public function __construct(
) {}

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template OutputType of non-empty-array<array-key, mixed>|object
* @template InputType
* @template OutputType
*
* @param \Iterator<int<0, max>, InputType|null> $source
* @param \Generator<int<0, max>, ResultBucketInterface<OutputType>|AcceptanceResultBucketInterface<InputType>|RejectionResultBucketInterface<InputType>|null, InputType, void> $coroutine
* @param \Generator<int, ResultBucketInterface<OutputType>|AcceptanceResultBucketInterface<InputType>|RejectionResultBucketInterface<InputType>|null, InputType, void> $coroutine
* @param StepRejectionInterface<InputType> $rejection
*
* @return \Iterator<int<0, max>, ResultBucketInterface<OutputType>>
Expand Down
30 changes: 20 additions & 10 deletions src/Transformer/BatchingTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Kiboko\Contract\Pipeline\TransformerInterface;

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template OutputType of non-empty-array<array-key, InputType>
* @template InputType
* @template OutputType of list<InputType>
*
* @implements TransformerInterface<InputType, OutputType>
* @implements FlushableInterface<OutputType>
Expand All @@ -29,36 +29,46 @@ public function __construct(
private readonly int $batchSize
) {}

/** @return \Generator<int<0, max>, ResultBucketInterface<OutputType>|EmptyResultBucket, InputType|null, void> */
/** @return \Generator<int, ResultBucketInterface<OutputType>, InputType|null, void> */
public function transform(): \Generator
{
$this->batch = [];

$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
/* @phpstan-ignore-next-line */
while (true) {
if (null === $line) {
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
continue;
}
$this->batch[] = $line;

if (\count($this->batch) >= $this->batchSize) {
/** @phpstan-ignore-next-line */
$line = yield new AcceptanceResultBucket($this->batch);
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new AcceptanceResultBucket($this->batch);
$line = yield $bucket;

$this->batch = [];
continue;
}

$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
}
}

/** @return AcceptanceResultBucket<OutputType>|EmptyResultBucket */
/** @return ResultBucketInterface<OutputType> */
public function flush(): ResultBucketInterface
{
if (\count($this->batch) <= 0) {
return new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
return $bucket;
}

/* @phpstan-ignore-next-line */
Expand Down
23 changes: 14 additions & 9 deletions src/Transformer/CallableTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

use Kiboko\Component\Bucket\AcceptanceResultBucket;
use Kiboko\Component\Bucket\EmptyResultBucket;
use Kiboko\Contract\Bucket\ResultBucketInterface;
use Kiboko\Contract\Pipeline\TransformerInterface;

/**
* @template InputType of non-empty-array<array-key, mixed>|object
* @template OutputType of non-empty-array<array-key, mixed>|object
* @template InputType
* @template OutputType
*
* @template-implements TransformerInterface<InputType, OutputType>
*/
Expand All @@ -20,30 +21,34 @@ class CallableTransformer implements TransformerInterface
private $callback;

/**
* @param callable(InputType $item): OutputType $callback
* @param callable(InputType|null $item): OutputType $callback
*/
public function __construct(
callable $callback,
) {
$this->callback = $callback;
}

/**
* @return \Generator<int<0, max>, AcceptanceResultBucket<OutputType>|EmptyResultBucket, InputType|null, void>
*/
/** @return \Generator<int, ResultBucketInterface<OutputType>, InputType|null, void> */
public function transform(): \Generator
{
$callback = $this->callback;

$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
/* @phpstan-ignore-next-line */
while (true) {
if (null === $line) {
$line = yield new EmptyResultBucket();
/** @var EmptyResultBucket<OutputType> $bucket */
$bucket = new EmptyResultBucket();
$line = yield $bucket;
continue;
}

$line = yield new AcceptanceResultBucket($callback($line));
/** @var AcceptanceResultBucket<OutputType> $bucket */
$bucket = new AcceptanceResultBucket($callback($line));
$line = yield $bucket;
}
}
}
Loading

0 comments on commit bbc5991

Please sign in to comment.