Skip to content

Commit 7b55f52

Browse files
committed
[WIP] Simplify now that promise cleans up canceller function
Refs reactphp/promise#119
1 parent bb49172 commit 7b55f52

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/functions.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ function timeout(PromiseInterface $promise, $time, LoopInterface $loop)
1313
// thus leaving responsibility to the input promise.
1414
$canceller = null;
1515
if ($promise instanceof CancellablePromiseInterface) {
16-
// pass promise by reference to clean reference after cancellation handler
17-
// has been invoked once in order to avoid garbage references in call stack.
1816
$canceller = function () use (&$promise) {
1917
$promise->cancel();
2018
$promise = null;
@@ -64,8 +62,7 @@ function resolve($time, LoopInterface $loop)
6462
$resolve($time);
6563
});
6664
}, function () use (&$timer, $loop) {
67-
// cancelling this promise will cancel the timer, clean the reference
68-
// in order to avoid garbage references in call stack and then reject.
65+
// cancelling this promise will cancel the timer and reject
6966
$loop->cancelTimer($timer);
7067
$timer = null;
7168

tests/FunctionTimeoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use React\Promise\Timer;
66
use React\Promise;
77

8-
class FunctionTimerTest extends TestCase
8+
class FunctionTimeoutTest extends TestCase
99
{
1010
public function testResolvedWillResolveRightAway()
1111
{

0 commit comments

Comments
 (0)