Skip to content

Commit 79a09ff

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

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
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

0 commit comments

Comments
 (0)