lib/Loop/Loop.php
public function tick(bool $block = false): bool
    {
        $this->runNextTicks();
        $nextTimeout = $this->runTimers();

        // Calculating how long runStreams should at most wait.
        if (!$block) {
            // Don't wait
            $streamWait = 0;
        } elseif ($this->nextTick) {
            // There's a pending 'nextTick'. Don't wait.
            $streamWait = 0;
        } elseif (is_numeric($nextTimeout)) {
            // Wait until the next Timeout should trigger.
            $streamWait = $nextTimeout;
        } else {
            // Wait indefinitely
            $streamWait = null;
        }

        $this->runStreams($streamWait);

        return $this->readStreams || $this->writeStreams || $this->nextTick || $this->timers;
    }
public function tick(bool $block = false): bool
    {
        $this->runNextTicks();
        $nextTimeout = $this->runTimers();

        // Calculating how long runStreams should at most wait.
        if (!$block) {
            // Don't wait
            $streamWait = 0;
        } elseif ($this->nextTick) {
            // There's a pending 'nextTick'. Don't wait.
            $streamWait = 0;
        } elseif (is_numeric($nextTimeout)) {
            // Wait until the next Timeout should trigger.
            $streamWait = $nextTimeout;
        } else {
            // Wait indefinitely
            $streamWait = null;
        }

        $this->runStreams($streamWait);

        return $this->readStreams || $this->writeStreams || $this->nextTick || $this->timers;
    }
public function tick ( bool $ block = false ) : bool { $ this -> runNextTicks ( ) ; $ nextTimeout = $ this -> runTimers ( ) ; // Calculating how long runStreams should at most wait. if ( ! $ block ) { // Don't wait $ streamWait = 0 ; } elseif ( $ this -> nextTick ) { // There's a pending 'nextTick'. Don't wait. $ streamWait = 0 ; } elseif ( is_numeric ( $ nextTimeout ) ) { // Wait until the next Timeout should trigger. $ streamWait = $ nextTimeout ; } else { // Wait indefinitely $ streamWait = null ; } $ this -> runStreams ( $ streamWait ) ; return $ this -> readStreams || $ this -> writeStreams || $ this -> nextTick || $ this -> timers ; }
Executes all pending events.

If $block is turned true, this function will block until any event is
triggered.

If there are now timeouts, nextTick callbacks or events in the loop at
all, this function will exit immediately.

This function will return true if there are _any_ events left in the
loop after the tick.
Executes all pending events .