Skip to content

Imported global functions #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Replaced constant references with fully qualified constant references
  • Loading branch information
Ocramius committed Jun 14, 2018
commit 88d35a67c1b4cde4cea28643c1f4a6a52697a1c9
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
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