-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
use Kiboko\Contract\Bucket\ResultBucketInterface; | ||
|
||
/** | ||
* @template Type of non-empty-array<array-key, mixed>|object | ||
* @template Type | ||
*/ | ||
class GeneratorWrapper | ||
{ | ||
|
@@ -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 GitHub Actions / phpstan
Check failure on line 46 in src/GeneratorWrapper.php GitHub Actions / phpstan
Check failure on line 46 in src/GeneratorWrapper.php GitHub Actions / phpstan
Check failure on line 46 in src/GeneratorWrapper.php GitHub Actions / phpstan
Check failure on line 46 in src/GeneratorWrapper.php GitHub Actions / phpstan
|
||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 19 in src/Loader/LogLoader.php GitHub Actions / phpstan
|
||
{ | ||
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 GitHub Actions / phpstan
Check failure on line 24 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 24 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 24 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 24 in src/Loader/LogLoader.php GitHub Actions / phpstan
|
||
{ | ||
$line = yield new EmptyResultBucket(); | ||
/** @var EmptyResultBucket<Type> $bucket */ | ||
$bucket = new EmptyResultBucket(); | ||
Check failure on line 27 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 27 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 27 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 27 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 27 in src/Loader/LogLoader.php GitHub Actions / phpstan
|
||
$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 GitHub Actions / phpstan
Check failure on line 33 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 33 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 33 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 33 in src/Loader/LogLoader.php GitHub Actions / phpstan
|
||
$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 GitHub Actions / phpstan
Check failure on line 40 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 40 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 40 in src/Loader/LogLoader.php GitHub Actions / phpstan
Check failure on line 40 in src/Loader/LogLoader.php GitHub Actions / phpstan
|
||
$line = yield $bucket; | ||
} | ||
} | ||
} |