66use React \EventLoop \Loop ;
77use React \Promise \Deferred ;
88use React \Promise \PromiseInterface ;
9- use function Clue \ React \Block \await ;
9+ use function React \Async \await ;
1010use function React \Promise \Timer \timeout ;
1111
1212class FunctionalTest extends TestCase
@@ -27,8 +27,8 @@ public function testPing(): void
2727 {
2828 $ redis = new RedisClient ($ this ->uri );
2929
30+ /** @var PromiseInterface<string> */
3031 $ promise = $ redis ->ping ();
31- $ this ->assertInstanceOf (PromiseInterface::class, $ promise );
3232
3333 $ ret = await ($ promise );
3434
@@ -39,8 +39,8 @@ public function testPingLazy(): void
3939 {
4040 $ redis = new RedisClient ($ this ->uri );
4141
42+ /** @var PromiseInterface<string> */
4243 $ promise = $ redis ->ping ();
43- $ this ->assertInstanceOf (PromiseInterface::class, $ promise );
4444
4545 $ ret = await ($ promise );
4646
@@ -77,6 +77,7 @@ public function testMgetIsNotInterpretedAsSubMessage(): void
7777
7878 $ redis ->mset ('message ' , 'message ' , 'channel ' , 'channel ' , 'payload ' , 'payload ' );
7979
80+ /** @var PromiseInterface<never> */
8081 $ promise = $ redis ->mget ('message ' , 'channel ' , 'payload ' )->then ($ this ->expectCallableOnce ());
8182 $ redis ->on ('message ' , $ this ->expectCallableNever ());
8283
@@ -90,6 +91,8 @@ public function testPipeline(): void
9091 $ redis ->set ('a ' , 1 )->then ($ this ->expectCallableOnceWith ('OK ' ));
9192 $ redis ->incr ('a ' )->then ($ this ->expectCallableOnceWith (2 ));
9293 $ redis ->incr ('a ' )->then ($ this ->expectCallableOnceWith (3 ));
94+
95+ /** @var PromiseInterface<void> */
9396 $ promise = $ redis ->get ('a ' )->then ($ this ->expectCallableOnceWith ('3 ' ));
9497
9598 await ($ promise );
@@ -98,6 +101,8 @@ public function testPipeline(): void
98101 public function testInvalidCommand (): void
99102 {
100103 $ redis = new RedisClient ($ this ->uri );
104+
105+ /** @var PromiseInterface<never> */
101106 $ promise = $ redis ->doesnotexist (1 , 2 , 3 );
102107
103108 $ this ->expectException (\Exception::class);
@@ -108,6 +113,8 @@ public function testMultiExecEmpty(): void
108113 {
109114 $ redis = new RedisClient ($ this ->uri );
110115 $ redis ->multi ()->then ($ this ->expectCallableOnceWith ('OK ' ));
116+
117+ /** @var PromiseInterface<void> */
111118 $ promise = $ redis ->exec ()->then ($ this ->expectCallableOnceWith ([]));
112119
113120 await ($ promise );
@@ -122,6 +129,8 @@ public function testMultiExecQueuedExecHasValues(): void
122129 $ redis ->expire ('b ' , 20 )->then ($ this ->expectCallableOnceWith ('QUEUED ' ));
123130 $ redis ->incrBy ('b ' , 2 )->then ($ this ->expectCallableOnceWith ('QUEUED ' ));
124131 $ redis ->ttl ('b ' )->then ($ this ->expectCallableOnceWith ('QUEUED ' ));
132+
133+ /** @var PromiseInterface<void> */
125134 $ promise = $ redis ->exec ()->then ($ this ->expectCallableOnceWith (['OK ' , 1 , 12 , 20 ]));
126135
127136 await ($ promise );
@@ -135,6 +144,7 @@ public function testPubSub(): void
135144 $ channel = 'channel:test: ' . mt_rand ();
136145
137146 // consumer receives a single message
147+ /** @var Deferred<void> */
138148 $ deferred = new Deferred ();
139149 $ consumer ->on ('message ' , $ this ->expectCallableOnce ());
140150 $ consumer ->on ('message ' , [$ deferred , 'resolve ' ]);
@@ -148,7 +158,9 @@ public function testPubSub(): void
148158
149159 await (timeout ($ deferred ->promise (), 0.1 ));
150160
151- await ($ consumer ->unsubscribe ($ channel ));
161+ /** @var PromiseInterface<array{0:"unsubscribe",1:string,2:0}> */
162+ $ promise = $ consumer ->unsubscribe ($ channel );
163+ await ($ promise );
152164 }
153165
154166 public function testClose (): void
0 commit comments