File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 11
11
}
12
12
],
13
13
"require" : {
14
- "php" : " ^7.1|^8.0 " ,
14
+ "php" : " ^8.1 " ,
15
15
"php-http/httplug" : " ^2.0" ,
16
16
"react/http" : " ^1.0" ,
17
17
"react/event-loop" : " ^1.2" ,
18
- "php-http/discovery" : " ^1.0"
18
+ "php-http/discovery" : " ^1.0" ,
19
+ "react/async" : " ^4@dev"
19
20
},
20
21
"require-dev" : {
21
22
"php-http/client-integration-tests" : " ^3.0" ,
Original file line number Diff line number Diff line change 10
10
use React \EventLoop \LoopInterface ;
11
11
use React \Promise \PromiseInterface ;
12
12
use RuntimeException ;
13
+ use function React \Async \await ;
13
14
14
15
/**
15
16
* React promise adapter implementation.
@@ -114,13 +115,9 @@ public function getState()
114
115
*/
115
116
public function wait ($ unwrap = true )
116
117
{
117
- $ loop = $ this ->loop ;
118
- while (HttpPromise::PENDING === $ this ->getState ()) {
119
- $ loop ->futureTick (function () use ($ loop ) {
120
- $ loop ->stop ();
121
- });
122
- $ loop ->run ();
123
- }
118
+ try {
119
+ await ($ this ->promise );
120
+ } catch (\Throwable ) {}
124
121
125
122
if ($ unwrap ) {
126
123
if (HttpPromise::REJECTED == $ this ->getState ()) {
You can’t perform that action at this time.
0 commit comments