From fae70bf0a7f1b566d25e30064f60d58ab150951a Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 7 May 2020 23:35:02 +0200 Subject: Revert "composer updates" This reverts commit dbfe748d274f6843fc91a3071df7be45c4ab5b00 --- vendor/sabre/event/lib/Loop/functions.php | 85 ++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 30 deletions(-) (limited to 'vendor/sabre/event/lib/Loop/functions.php') diff --git a/vendor/sabre/event/lib/Loop/functions.php b/vendor/sabre/event/lib/Loop/functions.php index bf4d933f2..b5884b2b6 100644 --- a/vendor/sabre/event/lib/Loop/functions.php +++ b/vendor/sabre/event/lib/Loop/functions.php @@ -1,15 +1,16 @@ -setTimeout($cb, $timeout); + } /** @@ -18,27 +19,35 @@ function setTimeout(callable $cb, float $timeout) * The value this function returns can be used to stop the interval with * clearInterval. */ -function setInterval(callable $cb, float $timeout): array -{ +function setInterval(callable $cb, float $timeout) : array { + return instance()->setInterval($cb, $timeout); + } /** * Stops a running interval. + * + * @return void */ -function clearInterval(array $intervalId) -{ +function clearInterval(array $intervalId) { + instance()->clearInterval($intervalId); + } /** * Runs a function immediately at the next iteration of the loop. + * + * @return void */ -function nextTick(callable $cb) -{ +function nextTick(callable $cb) { + instance()->nextTick($cb); + } + /** * Adds a read stream. * @@ -49,10 +58,12 @@ function nextTick(callable $cb) * prevent the eventloop from never stopping. * * @param resource $stream + * @return void */ -function addReadStream($stream, callable $cb) -{ +function addReadStream($stream, callable $cb) { + instance()->addReadStream($stream, $cb); + } /** @@ -65,41 +76,51 @@ function addReadStream($stream, callable $cb) * prevent the eventloop from never stopping. * * @param resource $stream + * @return void */ -function addWriteStream($stream, callable $cb) -{ +function addWriteStream($stream, callable $cb) { + instance()->addWriteStream($stream, $cb); + } /** * Stop watching a stream for reads. * * @param resource $stream + * @return void */ -function removeReadStream($stream) -{ +function removeReadStream($stream) { + instance()->removeReadStream($stream); + } /** * Stop watching a stream for writes. * * @param resource $stream + * @return void */ -function removeWriteStream($stream) -{ +function removeWriteStream($stream) { + instance()->removeWriteStream($stream); + } + /** * Runs the loop. * - * This function will run continuously, until there's no more events to + * This function will run continiously, until there's no more events to * handle. + * + * @return void */ -function run() -{ +function run() { + instance()->run(); + } /** @@ -114,30 +135,34 @@ function run() * This function will return true if there are _any_ events left in the * loop after the tick. */ -function tick(bool $block = false): bool -{ +function tick(bool $block = false) : bool { + return instance()->tick($block); + } /** - * Stops a running eventloop. + * Stops a running eventloop + * + * @return void */ -function stop() -{ +function stop() { + instance()->stop(); + } /** * Retrieves or sets the global Loop object. */ -function instance(Loop $newLoop = null): Loop -{ +function instance(Loop $newLoop = null) : Loop { + static $loop; if ($newLoop) { $loop = $newLoop; } elseif (!$loop) { $loop = new Loop(); } - return $loop; + } -- cgit v1.2.3