1
0
mirror of https://github.com/danog/loop.git synced 2024-11-30 04:19:04 +01:00

Psalm improvements

This commit is contained in:
Daniil Gentili 2023-01-24 12:04:34 +01:00
parent ac1ad0f204
commit 1d7b352ceb

View File

@ -32,13 +32,16 @@ class PeriodicLoop extends GenericLoop
*/ */
public function __construct(callable $callback, string $name, ?float $interval) public function __construct(callable $callback, string $name, ?float $interval)
{ {
/** @psalm-suppress ArgumentTypeCoercion */ /** @psalm-suppress InvalidArgument */
parent::__construct(static function (self $loop) use ($callback, $interval): ?float { parent::__construct(
/** @psalm-suppress ArgumentTypeCoercion */ /** @param static $loop */
if ($callback($loop) === true) { static function (self $loop) use ($callback, $interval): ?float {
return GenericLoop::STOP; if ($callback($loop) === true) {
} return GenericLoop::STOP;
return $interval; }
}, $name); return $interval;
},
$name
);
} }
} }