@@ -119,13 +119,13 @@ public function addTimer($interval, $callback)
119119 $ callback = function () use ($ timer , $ timers , $ that ) {
120120 \call_user_func ($ timer ->getCallback (), $ timer );
121121
122- if ($ timers ->contains ($ timer )) {
122+ if ($ timers ->offsetExists ($ timer )) {
123123 $ that ->cancelTimer ($ timer );
124124 }
125125 };
126126
127127 $ event = \uv_timer_init ($ this ->uv );
128- $ this ->timers ->attach ($ timer , $ event );
128+ $ this ->timers ->offsetSet ($ timer , $ event );
129129 \uv_timer_start (
130130 $ event ,
131131 $ this ->convertFloatSecondsToMilliseconds ($ interval ),
@@ -149,7 +149,7 @@ public function addPeriodicTimer($interval, $callback)
149149
150150 $ interval = $ this ->convertFloatSecondsToMilliseconds ($ interval );
151151 $ event = \uv_timer_init ($ this ->uv );
152- $ this ->timers ->attach ($ timer , $ event );
152+ $ this ->timers ->offsetSet ($ timer , $ event );
153153 \uv_timer_start (
154154 $ event ,
155155 $ interval ,
@@ -167,7 +167,7 @@ public function cancelTimer(TimerInterface $timer)
167167 {
168168 if (isset ($ this ->timers [$ timer ])) {
169169 @\uv_timer_stop ($ this ->timers [$ timer ]);
170- $ this ->timers ->detach ($ timer );
170+ $ this ->timers ->offsetUnset ($ timer );
171171 }
172172 }
173173
0 commit comments