mirror of
https://github.com/danog/loop.git
synced 2024-11-30 04:19:04 +01:00
Psalm improvements
This commit is contained in:
parent
ac1ad0f204
commit
1d7b352ceb
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user