File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
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
18
"php-http/discovery" : " ^1.0" ,
19
- "phpunit/phpunit" : " ^9.3.11 || ^7"
19
+ "phpunit/phpunit" : " ^9.3.11 || ^7" ,
20
+ "react/async" : " ^4@dev"
20
21
},
21
22
"require-dev" : {
22
23
"php-http/client-integration-tests" : " ^3.0" ,
Original file line number Diff line number Diff line change 7
7
use Http \Promise \Promise as HttpPromise ;
8
8
use Psr \Http \Message \RequestInterface ;
9
9
use Psr \Http \Message \ResponseInterface ;
10
+ use function React \Async \await ;
10
11
use React \EventLoop \LoopInterface ;
11
12
use React \Promise \PromiseInterface ;
12
13
use RuntimeException ;
@@ -114,12 +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 ();
118
+ try {
119
+ await ($ this ->promise );
120
+ } catch (\Throwable ) {
123
121
}
124
122
125
123
if ($ unwrap ) {
You can’t perform that action at this time.
0 commit comments