File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
require __DIR__ . '/vendor/autoload.php ' ;
3
3
4
- use Rcalicdan \FiberAsync \Promise \Interfaces \ PromiseInterface ;
4
+ use Rcalicdan \FiberAsync \Promise \CancellablePromise ;
5
5
use Rcalicdan \FiberAsync \Promise \Promise ;
6
6
7
- $ promises = Promise::all ([
8
- delay (1 ),
9
- delay (2 ),
10
- delay (3 ),
11
- ]);
7
+
12
8
13
9
$ startTime = microtime (true );
14
- run (function () use ($ promises ) {
10
+ run (function () {
11
+ $ promises = delay (1 )->setTimerId ();
15
12
await ($ promises );
16
13
});
17
14
18
- run (function () use ($ promises ) {
19
- await ($ promises );
20
- });
21
15
22
16
$ endTime = microtime (true );
23
17
$ executionTime = $ endTime - $ startTime ;
Original file line number Diff line number Diff line change 257
257
$ promise ->cancel ();
258
258
259
259
expect ($ promise ->isCancelled ())->toBeTrue ();
260
-
261
- // Test that the chained promise has access to the root cancellable
262
- // (this depends on the internal implementation)
260
+
263
261
if (method_exists ($ chainedPromise , 'getRootCancellable ' )) {
264
262
expect ($ chainedPromise ->getRootCancellable ())->toBe ($ promise );
265
263
}
You can’t perform that action at this time.
0 commit comments