From 354a2ec25269b630ece65f149e1ccb438380f56c Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 12 Jul 2022 22:19:22 +0200 Subject: [PATCH] Remove deprecated future combinators --- src/Future/functions.php | 99 ---------------------------------------- 1 file changed, 99 deletions(-) diff --git a/src/Future/functions.php b/src/Future/functions.php index f49eb3ec..c6f13f38 100644 --- a/src/Future/functions.php +++ b/src/Future/functions.php @@ -30,27 +30,6 @@ function awaitFirst(iterable $futures, ?Cancellation $cancellation = null): mixe throw new CompositeLengthException('Argument #1 ($futures) is empty'); } -/** - * Unwraps the first completed future. - * - * If you want the first future completed without an error, use {@see any()} instead. - * - * @template T - * - * @param iterable> $futures - * @param Cancellation|null $cancellation Optional cancellation. - * - * @return T - * - * @throws CompositeLengthException If $futures is empty. - * - * @deprecated Use {@see awaitFirst()} instead. - */ -function race(iterable $futures, ?Cancellation $cancellation = null): mixed -{ - return awaitFirst($futures, $cancellation); -} - /** * Awaits the first successfully completed future, ignoring errors. * @@ -73,29 +52,6 @@ function awaitAny(iterable $futures, ?Cancellation $cancellation = null): mixed return $result[\array_key_first($result)]; } -/** - * Awaits the first successfully completed future, ignoring errors. - * - * If you want the first future completed, successful or not, use {@see awaitFirst()} instead. - * - * @template Tk of array-key - * @template Tv - * - * @param iterable> $futures - * @param Cancellation|null $cancellation Optional cancellation. - * - * @return Tv - * - * @throws CompositeException If all futures errored. - * @throws CompositeLengthException If {@code $futures} is empty. - * - * @deprecated Use {@see awaitFirst()} instead. - */ -function any(iterable $futures, ?Cancellation $cancellation = null): mixed -{ - return awaitAny($futures, $cancellation); -} - /** * Awaits the first N successfully completed futures, ignoring errors. * @@ -141,26 +97,6 @@ function awaitAnyN(int $count, iterable $futures, ?Cancellation $cancellation = throw new CompositeException($errors); } -/** - * @template Tk of array-key - * @template Tv - * - * @param iterable> $futures - * @param positive-int $count - * @param Cancellation|null $cancellation Optional cancellation. - * - * @return non-empty-array - * - * @throws CompositeException If all futures errored. - * @throws CompositeLengthException If {@code $futures} is empty. - * - * @deprecated Use {@see awaitAnyN()} instead. - */ -function some(iterable $futures, int $count, ?Cancellation $cancellation = null): array -{ - return awaitAnyN($count, $futures, $cancellation); -} - /** * Awaits all futures to complete or error. * @@ -190,22 +126,6 @@ function awaitAll(iterable $futures, ?Cancellation $cancellation = null): array return [$errors, $values]; } -/** - * @template Tk of array-key - * @template Tv - * - * @param iterable> $futures - * @param Cancellation|null $cancellation Optional cancellation. - * - * @return array{array, array} - * - * @deprecated Use {@see awaitAll()} instead. - */ -function settle(iterable $futures, ?Cancellation $cancellation = null): array -{ - return awaitAll($futures, $cancellation); -} - /** * Awaits all futures to complete or aborts if any errors. * @@ -235,22 +155,3 @@ function await(iterable $futures, ?Cancellation $cancellation = null): array /** @var array */ return $values; } - -/** - * Awaits all futures to complete or aborts if any errors. The returned array keys will be in the order the futures - * resolved, not in the order given by the iterable. Sort the array after resolution if necessary. - * - * @template Tk of array-key - * @template Tv - * - * @param iterable> $futures - * @param Cancellation|null $cancellation Optional cancellation. - * - * @return array Unwrapped values with the order preserved. - * - * @deprecated Use {@see await()} instead. - */ -function all(iterable $futures, ?Cancellation $cancellation = null): array -{ - return await($futures, $cancellation); -}