Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Table of Contents
* [resolve()](#resolve)
* [reject()](#reject)
* [all()](#all)
* [race()](#race)
* [any()](#any)
* [some()](#some)
* [map()](#map)
Expand Down Expand Up @@ -387,8 +386,8 @@ $promise->then(function ($value) {
Useful functions for creating, joining, mapping and reducing collections of
promises.

All functions working on promise collections (like `all()`, `race()`, `some()`
etc.) support cancellation. This means, if you call `cancel()` on the returned
All functions working on promise collections (like `all()`, `some()` etc.)
support cancellation. This means, if you call `cancel()` on the returned
promise, all promises in the collection are cancelled.

#### resolve()
Expand Down Expand Up @@ -436,15 +435,6 @@ Returns a promise that will resolve only once all the items in
will be an array containing the resolution values of each of the items in
`$promisesOrValues`.

#### race()

```php
$promise = React\Promise\race(array $promisesOrValues);
```

Initiates a competitive race that allows one winner. Returns a promise which is
resolved in the same way the first settled promise resolves.

#### any()

```php
Expand Down
18 changes: 0 additions & 18 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ function all(array $promisesOrValues)
});
}

function race(array $promisesOrValues)
{
if (!$promisesOrValues) {
return resolve();
}

$cancellationQueue = new Internal\CancellationQueue();

return new Promise(function ($resolve, $reject) use ($promisesOrValues, $cancellationQueue) {
foreach ($promisesOrValues as $promiseOrValue) {
$cancellationQueue->enqueue($promiseOrValue);

resolve($promiseOrValue)
->done($resolve, $reject);
}
}, $cancellationQueue);
}

function any(array $promisesOrValues)
{
return some($promisesOrValues, 1)
Expand Down
156 changes: 0 additions & 156 deletions tests/FunctionRaceTest.php

This file was deleted.