Skip to content

Commit

Permalink
Replaced constant references with fully qualified constant references
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Jun 14, 2018
1 parent b048bd7 commit 88d35a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/ExtEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function addReadStream($stream, $listener)

// ext-event does not increase refcount on stream resources for PHP 7+
// manually keep track of stream resource to prevent premature garbage collection
if (PHP_VERSION_ID >= 70000) {
if (\PHP_VERSION_ID >= 70000) {
$this->readRefs[$key] = $stream;
}
}
Expand All @@ -88,7 +88,7 @@ public function addWriteStream($stream, $listener)

// ext-event does not increase refcount on stream resources for PHP 7+
// manually keep track of stream resource to prevent premature garbage collection
if (PHP_VERSION_ID >= 70000) {
if (\PHP_VERSION_ID >= 70000) {
$this->writeRefs[$key] = $stream;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/ExtLibeventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function addReadStream($stream, $listener)
}

$event = \event_new();
\event_set($event, $stream, EV_PERSIST | EV_READ, $this->streamCallback);
\event_set($event, $stream, \EV_PERSIST | \EV_READ, $this->streamCallback);
\event_base_set($event, $this->eventBase);
\event_add($event);

Expand All @@ -90,7 +90,7 @@ public function addWriteStream($stream, $listener)
}

$event = \event_new();
\event_set($event, $stream, EV_PERSIST | EV_WRITE, $this->streamCallback);
\event_set($event, $stream, \EV_PERSIST | \EV_WRITE, $this->streamCallback);
\event_base_set($event, $this->eventBase);
\event_add($event);

Expand Down Expand Up @@ -170,7 +170,7 @@ public function addSignal($signal, $listener)

if (!isset($this->signalEvents[$signal])) {
$this->signalEvents[$signal] = \event_new();
\event_set($this->signalEvents[$signal], $signal, EV_PERSIST | EV_SIGNAL, array($this->signals, 'call'));
\event_set($this->signalEvents[$signal], $signal, \EV_PERSIST | \EV_SIGNAL, array($this->signals, 'call'));
\event_base_set($this->signalEvents[$signal], $this->eventBase);
\event_add($this->signalEvents[$signal]);
}
Expand All @@ -194,9 +194,9 @@ public function run()
while ($this->running) {
$this->futureTickQueue->tick();

$flags = EVLOOP_ONCE;
$flags = \EVLOOP_ONCE;
if (!$this->running || !$this->futureTickQueue->isEmpty()) {
$flags |= EVLOOP_NONBLOCK;
$flags |= \EVLOOP_NONBLOCK;
} elseif (!$this->readEvents && !$this->writeEvents && !$this->timerEvents->count() && $this->signals->isEmpty()) {
break;
}
Expand Down Expand Up @@ -271,11 +271,11 @@ private function createStreamCallback()
$this->streamCallback = function ($stream, $flags) use (&$read, &$write) {
$key = (int) $stream;

if (EV_READ === (EV_READ & $flags) && isset($read[$key])) {
if (\EV_READ === (\EV_READ & $flags) && isset($read[$key])) {
\call_user_func($read[$key], $stream);
}

if (EV_WRITE === (EV_WRITE & $flags) && isset($write[$key])) {
if (\EV_WRITE === (\EV_WRITE & $flags) && isset($write[$key])) {
\call_user_func($write[$key], $stream);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function create()
return new ExtEvLoop();
} elseif (\class_exists('EventBase', false)) {
return new ExtEventLoop();
} elseif (\function_exists('event_base_new') && PHP_VERSION_ID < 70000) {
} elseif (\function_exists('event_base_new') && \PHP_VERSION_ID < 70000) {
// only use ext-libevent on PHP < 7 for now
return new ExtLibeventLoop();
}
Expand Down
4 changes: 2 additions & 2 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function removeSignal($signal, $listener)
$this->signals->remove($signal, $listener);

if ($this->signals->count($signal) === 0) {
\pcntl_signal($signal, SIG_DFL);
\pcntl_signal($signal, \SIG_DFL);
}
}

Expand All @@ -190,7 +190,7 @@ public function run()
// Ensure we do not exceed maximum integer size, which may
// cause the loop to tick once every ~35min on 32bit systems.
$timeout *= self::MICROSECONDS_PER_SECOND;
$timeout = $timeout > PHP_INT_MAX ? PHP_INT_MAX : (int)$timeout;
$timeout = $timeout > \PHP_INT_MAX ? \PHP_INT_MAX : (int)$timeout;
}

// The only possible event is stream or signal activity, so wait forever ...
Expand Down

0 comments on commit 88d35a6

Please sign in to comment.