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)
{
/** @psalm-suppress ArgumentTypeCoercion */
parent::__construct(static function (self $loop) use ($callback, $interval): ?float {
/** @psalm-suppress ArgumentTypeCoercion */
if ($callback($loop) === true) {
return GenericLoop::STOP;
}
return $interval;
}, $name);
/** @psalm-suppress InvalidArgument */
parent::__construct(
/** @param static $loop */
static function (self $loop) use ($callback, $interval): ?float {
if ($callback($loop) === true) {
return GenericLoop::STOP;
}
return $interval;
},
$name
);
}
}