@@ -11,12 +11,12 @@ class ReactAdapter implements LoopInterface
1111{
1212 private static \WeakMap $ instances ;
1313
14- private $ driver ;
14+ private Driver $ driver ;
1515
16- private $ readWatchers = [];
17- private $ writeWatchers = [];
18- private $ timers = [];
19- private $ signals = [];
16+ private array $ readWatchers = [];
17+ private array $ writeWatchers = [];
18+ private array $ timers = [];
19+ private array $ signals = [];
2020
2121 public static function get (): LoopInterface
2222 {
@@ -35,8 +35,7 @@ public function __construct(?Driver $driver = null)
3535 self ::$ instances [$ this ->driver ] = $ this ;
3636 }
3737
38- /** @inheritdoc */
39- public function addReadStream ($ stream , $ listener )
38+ public function addReadStream ($ stream , $ listener ): void
4039 {
4140 if (isset ($ this ->readWatchers [(int ) $ stream ])) {
4241 // Double watchers are silently ignored by ReactPHP
@@ -50,8 +49,7 @@ public function addReadStream($stream, $listener)
5049 $ this ->readWatchers [(int ) $ stream ] = $ watcher ;
5150 }
5251
53- /** @inheritdoc */
54- public function addWriteStream ($ stream , $ listener )
52+ public function addWriteStream ($ stream , $ listener ): void
5553 {
5654 if (isset ($ this ->writeWatchers [(int ) $ stream ])) {
5755 // Double watchers are silently ignored by ReactPHP
@@ -65,8 +63,7 @@ public function addWriteStream($stream, $listener)
6563 $ this ->writeWatchers [(int ) $ stream ] = $ watcher ;
6664 }
6765
68- /** @inheritdoc */
69- public function removeReadStream ($ stream )
66+ public function removeReadStream ($ stream ): void
7067 {
7168 $ key = (int ) $ stream ;
7269
@@ -79,8 +76,7 @@ public function removeReadStream($stream)
7976 unset($ this ->readWatchers [$ key ]);
8077 }
8178
82- /** @inheritdoc */
83- public function removeWriteStream ($ stream )
79+ public function removeWriteStream ($ stream ): void
8480 {
8581 $ key = (int ) $ stream ;
8682
@@ -93,7 +89,6 @@ public function removeWriteStream($stream)
9389 unset($ this ->writeWatchers [$ key ]);
9490 }
9591
96- /** @inheritdoc */
9792 public function addTimer ($ interval , $ callback ): TimerInterface
9893 {
9994 $ timer = new Timer ($ interval , $ callback , false );
@@ -110,7 +105,6 @@ public function addTimer($interval, $callback): TimerInterface
110105 return $ timer ;
111106 }
112107
113- /** @inheritdoc */
114108 public function addPeriodicTimer ($ interval , $ callback ): TimerInterface
115109 {
116110 $ timer = new Timer ($ interval , $ callback , true );
@@ -125,8 +119,7 @@ public function addPeriodicTimer($interval, $callback): TimerInterface
125119 return $ timer ;
126120 }
127121
128- /** @inheritdoc */
129- public function cancelTimer (TimerInterface $ timer )
122+ public function cancelTimer (TimerInterface $ timer ): void
130123 {
131124 if (!isset ($ this ->timers [\spl_object_hash ($ timer )])) {
132125 return ;
@@ -137,16 +130,14 @@ public function cancelTimer(TimerInterface $timer)
137130 unset($ this ->timers [\spl_object_hash ($ timer )]);
138131 }
139132
140- /** @inheritdoc */
141- public function futureTick ($ listener )
133+ public function futureTick ($ listener ): void
142134 {
143135 $ this ->driver ->defer (static function () use ($ listener ) {
144136 $ listener ();
145137 });
146138 }
147139
148- /** @inheritdoc */
149- public function addSignal ($ signal , $ listener )
140+ public function addSignal ($ signal , $ listener ): void
150141 {
151142 if (\in_array ($ listener , $ this ->signals [$ signal ] ?? [], true )) {
152143 return ;
@@ -158,13 +149,12 @@ public function addSignal($signal, $listener)
158149 });
159150
160151 $ this ->signals [$ signal ][$ watcherId ] = $ listener ;
161- } catch (EventLoop \UnsupportedFeatureException $ e ) {
152+ } catch (EventLoop \UnsupportedFeatureException ) {
162153 throw new \BadMethodCallException ("Signals aren't available in the current environment. " );
163154 }
164155 }
165156
166- /** @inheritdoc */
167- public function removeSignal ($ signal , $ listener )
157+ public function removeSignal ($ signal , $ listener ): void
168158 {
169159 if (!isset ($ this ->signals [$ signal ])) {
170160 return ;
@@ -183,19 +173,17 @@ public function removeSignal($signal, $listener)
183173 }
184174 }
185175
186- /** @inheritdoc */
187- public function run ()
176+ public function run (): void
188177 {
189178 $ this ->driver ->run ();
190179 }
191180
192- /** @inheritdoc */
193- public function stop ()
181+ public function stop (): void
194182 {
195183 $ this ->driver ->stop ();
196184 }
197185
198- private function deferEnabling (string $ watcherId )
186+ private function deferEnabling (string $ watcherId ): void
199187 {
200188 $ this ->driver ->disable ($ watcherId );
201189 $ this ->driver ->defer (function () use ($ watcherId ) {
0 commit comments