From 1d7b352ceb911cca79c110bfd6cee4412de08863 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 24 Jan 2023 12:04:34 +0100 Subject: [PATCH] Psalm improvements --- lib/PeriodicLoop.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/PeriodicLoop.php b/lib/PeriodicLoop.php index da2c0b6..e352d86 100644 --- a/lib/PeriodicLoop.php +++ b/lib/PeriodicLoop.php @@ -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 + ); } }