Skip to content

Commit

Permalink
Remove internal Queue leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Oct 6, 2022
1 parent ee59eae commit dd6a739
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 130 deletions.
13 changes: 5 additions & 8 deletions src/Internal/FulfilledPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use React\Promise\Promise;
use React\Promise\PromiseInterface;
use function React\Promise\enqueue;
use function React\Promise\resolve;

/**
Expand All @@ -30,13 +29,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null):
}

return new Promise(function (callable $resolve, callable $reject) use ($onFulfilled): void {
enqueue(function () use ($resolve, $reject, $onFulfilled): void {
try {
$resolve($onFulfilled($this->value));
} catch (\Throwable $exception) {
$reject($exception);
}
});
try {
$resolve($onFulfilled($this->value));
} catch (\Throwable $exception) {
$reject($exception);
}
});
}

Expand Down
30 changes: 0 additions & 30 deletions src/Internal/Queue.php

This file was deleted.

13 changes: 5 additions & 8 deletions src/Internal/RejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use React\Promise\Promise;
use React\Promise\PromiseInterface;
use function React\Promise\_checkTypehint;
use function React\Promise\enqueue;
use function React\Promise\resolve;

/**
Expand All @@ -27,13 +26,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null):
}

return new Promise(function (callable $resolve, callable $reject) use ($onRejected): void {
enqueue(function () use ($resolve, $reject, $onRejected): void {
try {
$resolve($onRejected($this->reason));
} catch (\Throwable $exception) {
$reject($exception);
}
});
try {
$resolve($onRejected($this->reason));
} catch (\Throwable $exception) {
$reject($exception);
}
});
}

Expand Down
14 changes: 0 additions & 14 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,6 @@ function (\Throwable $reason) use ($i, &$reasons, &$toReject, $reject, &$continu
}, $cancellationQueue);
}

/**
* @internal
*/
function enqueue(callable $task): void
{
static $queue;

if (!$queue) {
$queue = new Internal\Queue();
}

$queue->enqueue($task);
}

/**
* @internal
*/
Expand Down
70 changes: 0 additions & 70 deletions tests/Internal/QueueTest.php

This file was deleted.

0 comments on commit dd6a739

Please sign in to comment.