diff --git a/lib/Coroutine.php b/lib/Coroutine.php index f693c0d..3a58b62 100644 --- a/lib/Coroutine.php +++ b/lib/Coroutine.php @@ -29,8 +29,7 @@ final class Coroutine implements Awaitable { /** * @param \Generator $generator */ - public function __construct(\Generator $generator) - { + public function __construct(\Generator $generator) { $this->generator = $generator; /** @@ -77,8 +76,7 @@ final class Coroutine implements Awaitable { * @param mixed $yielded Value yielded from generator. * @param mixed $last Prior resolved value. No longer needed when PHP 5.x support is dropped. */ - private function next($yielded, $last = null) - { + private function next($yielded, $last = null) { if (!$this->generator->valid()) { $this->resolve(PHP_MAJOR_VERSION >= 7 ? $this->generator->getReturn() : $last); return; diff --git a/lib/Failure.php b/lib/Failure.php index f34d952..1c2c26f 100644 --- a/lib/Failure.php +++ b/lib/Failure.php @@ -16,8 +16,7 @@ class Failure implements Awaitable { * * @throws \InvalidArgumentException If a non-exception is given. */ - public function __construct($exception) - { + public function __construct($exception) { if (!$exception instanceof \Throwable && !$exception instanceof \Exception) { throw new \InvalidArgumentException('Failure reason must be an exception'); } diff --git a/lib/Internal/WhenQueue.php b/lib/Internal/WhenQueue.php index 9bde3e8..8116b5a 100644 --- a/lib/Internal/WhenQueue.php +++ b/lib/Internal/WhenQueue.php @@ -46,8 +46,7 @@ class WhenQueue { * * @param callable $callback */ - public function push(callable $callback) - { + public function push(callable $callback) { if ($callback instanceof self) { $this->queue = \array_merge($this->queue, $callback->queue); return; diff --git a/lib/functions.php b/lib/functions.php index 48ef6dd..1eb8604 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -230,8 +230,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function lazy(callable $promisor /* ...$args */) - { + function lazy(callable $promisor /* ...$args */) { $args = \array_slice(\func_get_args(), 1); if (empty($args)) { @@ -252,8 +251,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return callable */ - function promisify(callable $worker, $index = 0) - { + function promisify(callable $worker, $index = 0) { return function (/* ...$args */) use ($worker, $index) { $args = \func_get_args(); @@ -283,8 +281,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable Awaitable resolved by the $thenable object. */ - function adapt($thenable) - { + function adapt($thenable) { if (!\is_object($thenable) || !\method_exists($thenable, 'then')) { return fail(new \InvalidArgumentException('Must provide an object with a then() method')); } @@ -306,8 +303,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return callable */ - function lift(callable $worker) - { + function lift(callable $worker) { /** * @param mixed ...$args Awaitables or values. * @@ -335,8 +331,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function settle(array $awaitables) - { + function settle(array $awaitables) { if (empty($awaitables)) { return resolve([]); } @@ -368,8 +363,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function all(array $awaitables) - { + function all(array $awaitables) { if (empty($awaitables)) { return resolve([]); } @@ -405,8 +399,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function any(array $awaitables) - { + function any(array $awaitables) { if (empty($awaitables)) { return fail(new \InvalidArgumentException('No awaitables provided')); } @@ -444,8 +437,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function some(array $awaitables, $required) - { + function some(array $awaitables, $required) { $required = (int) $required; if (0 >= $required) { @@ -496,8 +488,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable */ - function choose(array $awaitables) - { + function choose(array $awaitables) { if (empty($awaitables)) { return fail(new \InvalidArgumentException('No awaitables provided')); } @@ -530,8 +521,7 @@ if (!\function_exists(__NAMESPACE__ . '\resolve')) { * * @return \Interop\Async\Awaitable[] Array of awaitables resolved with the result of the mapped function. */ - function map(callable $callback /* array ...$awaitables */) - { + function map(callable $callback /* array ...$awaitables */) { $args = \func_get_args(); $args[0] = lift($args[0]);