Skip to content

Commit

Permalink
Force leading backslashes everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed May 11, 2016
1 parent d9aa857 commit 452c9b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions lib/NativeReactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function tryImmediate($watcher) {
}

private function enableTimers() {
$now = microtime(true);
$now = \microtime(true);
foreach ($this->watchers as $watcherId => $watcher) {
if (!($watcher->type & Watcher::TIMER) || isset($watcher->nextExecutionAt) || !$watcher->isEnabled) {
continue;
Expand Down Expand Up @@ -269,7 +269,7 @@ private function doIoCallback($watcherId, $watcher, $stream) {
}

private function executeTimers() {
$now = microtime(true);
$now = \microtime(true);
if ($this->isTimerSortNeeded) {
\asort($this->timerOrder);
$this->isTimerSortNeeded = false;
Expand Down Expand Up @@ -348,13 +348,13 @@ public function once(callable $callback, $msDelay, array $options = []) {
$watcher->cbData = isset($options["cb_data"]) ? $options["cb_data"] : null;
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
$watcher->keepAlive = isset($options["keep_alive"]) ? (bool) $options["keep_alive"] : true;
$watcher->msDelay = round(($msDelay / 1000), 3);
$watcher->msDelay = \round(($msDelay / 1000), 3);
$watcher->nextExecutionAt = null;

$this->keepAliveCount += ($watcher->keepAlive && $watcher->isEnabled);

if ($watcher->isEnabled && $this->state > self::STOPPED) {
$nextExecutionAt = microtime(true) + $watcher->msDelay;
$nextExecutionAt = \microtime(true) + $watcher->msDelay;
$watcher->nextExecutionAt = $nextExecutionAt;
$this->timerOrder[$watcherId] = $nextExecutionAt;
$this->isTimerSortNeeded = true;
Expand Down Expand Up @@ -531,7 +531,7 @@ public function enable($watcherId) {
case Watcher::TIMER_ONCE:
case Watcher::TIMER_REPEAT:
if (!isset($watcher->nextExecutionAt)) {
$watcher->nextExecutionAt = microtime(true) + $watcher->msDelay;
$watcher->nextExecutionAt = \microtime(true) + $watcher->msDelay;
}
$this->isTimerSortNeeded = true;
$this->timerOrder[$watcherId] = $watcher->nextExecutionAt;
Expand Down
18 changes: 9 additions & 9 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function all(array $promises) {
}

$struct = new \StdClass;
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->results = [];
$struct->promisor = new Deferred;

Expand Down Expand Up @@ -293,7 +293,7 @@ function some(array $promises) {
}

$struct = new \StdClass;
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->errors = [];
$struct->results = [];
$struct->promisor = new Deferred;
Expand Down Expand Up @@ -345,7 +345,7 @@ function any(array $promises) {
}

$struct = new \StdClass;
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->errors = [];
$struct->results = [];
$struct->promisor = new Deferred;
Expand Down Expand Up @@ -392,7 +392,7 @@ function first(array $promises) {

$struct = new \StdClass;
$struct->errors = [];
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->promisor = new Deferred;

$onResolve = function ($error, $result, $cbData) {
Expand Down Expand Up @@ -440,7 +440,7 @@ function map(array $promises, callable $functor) {
}

$struct = new \StdClass;
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->results = [];
$struct->promisor = new Deferred;
$struct->functor = $functor;
Expand Down Expand Up @@ -524,7 +524,7 @@ function filter(array $promises, callable $functor = null) {
}

$struct = new \StdClass;
$struct->remaining = count($promises);
$struct->remaining = \count($promises);
$struct->results = [];
$struct->promisor = new Deferred;
$struct->functor = $functor;
Expand Down Expand Up @@ -757,11 +757,11 @@ function coroutine(callable $func) {
*/
function resolve($generator) {
if (!$generator instanceof \Generator) {
if (!is_callable($generator)) {
throw new \InvalidArgumentException('Coroutine to resolve must be callable or instance of Generator');
if (!\is_callable($generator)) {
throw new \InvalidArgumentException("Coroutine to resolve must be callable or instance of Generator");
}

$generator = call_user_func($generator);
$generator = \call_user_func($generator);

if (!$generator instanceof \Generator) {
throw new \LogicException('Callable passed to resolve() did not return an instance of Generator');
Expand Down

0 comments on commit 452c9b7

Please sign in to comment.