Skip to content

Commit

Permalink
Remove deprecated future combinators
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Jul 12, 2022
1 parent f682341 commit 354a2ec
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions src/Future/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<Future<T>> $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.
*
Expand All @@ -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<Tk, Future<Tv>> $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.
*
Expand Down Expand Up @@ -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<Tk, Future<Tv>> $futures
* @param positive-int $count
* @param Cancellation|null $cancellation Optional cancellation.
*
* @return non-empty-array<Tk, Tv>
*
* @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.
*
Expand Down Expand Up @@ -190,22 +126,6 @@ function awaitAll(iterable $futures, ?Cancellation $cancellation = null): array
return [$errors, $values];
}

/**
* @template Tk of array-key
* @template Tv
*
* @param iterable<Tk, Future<Tv>> $futures
* @param Cancellation|null $cancellation Optional cancellation.
*
* @return array{array<Tk, \Throwable>, array<Tk, Tv>}
*
* @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.
*
Expand Down Expand Up @@ -235,22 +155,3 @@ function await(iterable $futures, ?Cancellation $cancellation = null): array
/** @var array<Tk, Tv> */
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<Tk, Future<Tv>> $futures
* @param Cancellation|null $cancellation Optional cancellation.
*
* @return array<Tk, Tv> Unwrapped values with the order preserved.
*
* @deprecated Use {@see await()} instead.
*/
function all(iterable $futures, ?Cancellation $cancellation = null): array
{
return await($futures, $cancellation);
}

0 comments on commit 354a2ec

Please sign in to comment.