Skip to content

Commit 502b4b6

Browse files
authored
Merge pull request #145 from seregazhuk/master
Small code cleanup
2 parents f696392 + 2cbdc04 commit 502b4b6

File tree

6 files changed

+4
-29
lines changed

6 files changed

+4
-29
lines changed

src/ExtEventLoop.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use EventConfig as EventBaseConfig;
88
use React\EventLoop\Tick\FutureTickQueue;
99
use React\EventLoop\Timer\Timer;
10-
use React\EventLoop\TimerInterface;
1110
use SplObjectStorage;
1211

1312
/**

src/ExtLibevLoop.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use libev\TimerEvent;
99
use React\EventLoop\Tick\FutureTickQueue;
1010
use React\EventLoop\Timer\Timer;
11-
use React\EventLoop\TimerInterface;
1211
use SplObjectStorage;
1312

1413
/**

src/ExtLibeventLoop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use EventBase;
77
use React\EventLoop\Tick\FutureTickQueue;
88
use React\EventLoop\Timer\Timer;
9-
use React\EventLoop\TimerInterface;
109
use SplObjectStorage;
1110

1211
/**
@@ -245,9 +244,10 @@ private function createTimerCallback()
245244
// Timer already cancelled ...
246245
if (!$this->timerEvents->contains($timer)) {
247246
return;
247+
}
248248

249249
// Reschedule periodic timers ...
250-
} elseif ($timer->isPeriodic()) {
250+
if ($timer->isPeriodic()) {
251251
event_add(
252252
$this->timerEvents[$timer],
253253
$timer->getInterval() * self::MICROSECONDS_PER_SECOND

src/SignalsHandler.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace React\EventLoop;
44

5-
use React\EventLoop\TimerInterface;
6-
75
/**
86
* @internal
97
*/
@@ -32,7 +30,7 @@ public function __destruct()
3230

3331
public function add($signal, $listener)
3432
{
35-
if (count($this->signals) == 0 && $this->timer === null) {
33+
if (empty($this->signals) && $this->timer === null) {
3634
/**
3735
* Timer to keep the loop alive as long as there are any signal handlers registered
3836
*/
@@ -69,7 +67,7 @@ public function remove($signal, $listener)
6967
$off($signal);
7068
}
7169

72-
if (count($this->signals) == 0 && $this->timer instanceof TimerInterface) {
70+
if (empty($this->signals) && $this->timer instanceof TimerInterface) {
7371
$this->loop->cancelTimer($this->timer);
7472
$this->timer = null;
7573
}

src/StreamSelectLoop.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use React\EventLoop\Signal\Pcntl;
66
use React\EventLoop\Tick\FutureTickQueue;
77
use React\EventLoop\Timer\Timer;
8-
use React\EventLoop\TimerInterface;
98
use React\EventLoop\Timer\Timers;
109

1110
/**
@@ -277,20 +276,4 @@ private function streamSelect(array &$read, array &$write, $timeout)
277276

278277
return 0;
279278
}
280-
281-
/**
282-
* Iterate over signal listeners for the given signal
283-
* and call each of them with the signal as first
284-
* argument.
285-
*
286-
* @param int $signal
287-
*
288-
* @return void
289-
*/
290-
private function handleSignal($signal)
291-
{
292-
foreach ($this->signals[$signal] as $listener) {
293-
\call_user_func($listener, $signal);
294-
}
295-
}
296279
}

tests/Timer/TimersTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ class TimersTest extends TestCase
1010
{
1111
public function testBlockedTimer()
1212
{
13-
$loop = $this
14-
->getMockBuilder('React\EventLoop\LoopInterface')
15-
->getMock();
16-
1713
$timers = new Timers();
1814
$timers->tick();
1915

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy