From 58978733fd7817186ab2dbaa742706969cd2d4f2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 30 Aug 2023 22:27:38 +0700 Subject: [PATCH] id contains --- src/Timer/Timers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Timer/Timers.php b/src/Timer/Timers.php index 13b9ef2a..53c46d03 100644 --- a/src/Timer/Timers.php +++ b/src/Timer/Timers.php @@ -46,7 +46,8 @@ public function add(TimerInterface $timer) public function contains(TimerInterface $timer) { - return isset($this->timers[\spl_object_hash($timer)]); + $id = \PHP_VERSION_ID < 70200 ? \spl_object_hash($timer) : \spl_object_id($timer); + return isset($this->timers[$id]); } public function cancel(TimerInterface $timer)