8000 [EventLoop] Add typehint in loop interface for timer cancelling. · Undefined-Variables/event-loop@f08d638 · GitHub
[go: up one dir, main page]

Skip to content

Commit f08d638

Browse files
committed
[EventLoop] Add typehint in loop interface for timer cancelling.
1 parent c61c806 commit f08d638

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

LibEvLoop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function addPeriodicTimer($interval, $callback)
105105
return $timer;
106106
}
107107

108-
public function cancelTimer($timer)
108+
public function cancelTimer(TimerInterface $timer)
109109
{
110110
if (isset($this->timers[$timer])) {
111111
$this->loop->remove($this->timers[$timer]);

LibEventLoop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function addPeriodicTimer($interval, $callback)
192192
return $this->addTimerInternal($interval, $callback, true);
193193
}
194194

195-
public function cancelTimer($timer)
195+
public function cancelTimer(TimerInterface $timer)
196196
{
197197
if (isset($this->timers[$timer])) {
198198
$resource = $this->timers[$timer];

LoopInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace React\EventLoop;
44

5+
use React\EventLoop\Timer\TimerInterface;
6+
57
interface LoopInterface
68
{
79
public function addReadStream($stream, $listener);
@@ -13,7 +15,7 @@ public function removeStream($stream);
1315

1416
public function addTimer($interval, $callback);
1517
public function addPeriodicTimer($interval, $callback);
16-
public function cancelTimer($timer);
18+
public function cancelTimer(TimerInterface $timer);
1719

1820
public function tick();
1921
public function run();

StreamSelectLoop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function addPeriodicTimer($interval, $callback)
8484
return $timer;
8585
}
8686

87-
public function cancelTimer($timer)
87+
public function cancelTimer(TimerInterface $timer)
8888
{
8989
$this->timers->cancel($timer);
9090
}

0 commit comments

Comments
 (0)
0