File tree 6 files changed +6
-15
lines changed
6 files changed +6
-15
lines changed Original file line number Diff line number Diff line change 15
15
"clue/redis-protocol" : " 0.3.*" ,
16
16
"evenement/evenement" : " ^3.0 || ^2.0 || ^1.0" ,
17
17
"react/event-loop" : " ^1.2" ,
18
- "react/promise" : " ^3 || ^2.0 || ^1.1 " ,
18
+ "react/promise" : " ^3" ,
19
19
"react/promise-timer" : " ^1.10" ,
20
20
"react/socket" : " ^1.15"
21
21
},
Original file line number Diff line number Diff line change @@ -6,10 +6,7 @@ parameters:
6
6
- src/
7
7
- tests/
8
8
9
- reportUnmatchedIgnoredErrors: false
10
9
ignoreErrors:
11
- # ignore generic usage like `PromiseInterface<T>` for Promise v2/v1
12
- - '/^PHPDoc tag @return contains generic type React\\Promise\\PromiseInterface<.+> but interface React\\Promise\\PromiseInterface is not generic\.$/'
13
10
# ignore undefined methods due to magic `__call()` method
14
11
- '/^Call to an undefined method Clue\\React\\Redis\\RedisClient::.+\(\)\.$/'
15
12
- '/^Call to an undefined method Clue\\React\\Redis\\Io\\StreamingClient::.+\(\)\.$/'
Original file line number Diff line number Diff line change @@ -80,7 +80,6 @@ public function createClient(string $uri): PromiseInterface
80
80
unset($ parts ['path ' ]);
81
81
}
82
82
83
- /** @var PromiseInterface<ConnectionInterface> $connecting */
84
83
$ connecting = $ this ->connector ->connect ($ authority );
85
84
86
85
$ deferred = new Deferred (function ($ _ , $ reject ) use ($ connecting , $ uri ) {
@@ -96,7 +95,6 @@ public function createClient(string $uri): PromiseInterface
96
95
}, function () {
97
96
// ignore to avoid reporting unhandled rejection
98
97
});
99
- assert (\method_exists ($ connecting , 'cancel ' ));
100
98
$ connecting ->cancel ();
101
99
});
102
100
Original file line number Diff line number Diff line change @@ -229,7 +229,6 @@ public function close(): void
229
229
// ignore to avoid reporting unhandled rejection
230
230
});
231
231
if ($ this ->promise !== null ) {
232
- assert (\method_exists ($ this ->promise , 'cancel ' ));
233
232
$ this ->promise ->cancel ();
234
233
$ this ->promise = null ;
235
234
}
Original file line number Diff line number Diff line change @@ -459,7 +459,6 @@ public function testCancelWillRejectPromise(): void
459
459
460
460
$ promise = $ this ->factory ->createClient ('redis://127.0.0.1:2 ' );
461
461
462
- assert (method_exists ($ promise , 'cancel ' ));
463
462
$ promise ->cancel ();
464
463
465
464
$ promise ->then (null , $ this ->expectCallableOnceWith ($ this ->isInstanceOf (\RuntimeException::class)));
@@ -542,7 +541,6 @@ public function testCancelWillRejectWithUriInMessageAndCancelConnectorWhenConnec
542
541
543
542
$ promise = $ this ->factory ->createClient ($ uri );
544
543
545
- assert (method_exists ($ promise , 'cancel ' ));
546
544
$ promise ->cancel ();
547
545
548
546
$ promise ->then (null , $ this ->expectCallableOnceWith (
@@ -568,7 +566,6 @@ public function testCancelWillCloseConnectionWhenConnectionWaitsForSelect(): voi
568
566
569
567
$ promise = $ this ->factory ->createClient ('redis://127.0.0.1:2/123 ' );
570
568
571
- assert (method_exists ($ promise , 'cancel ' ));
572
569
$ promise ->cancel ();
573
570
574
571
$ promise ->then (null , $ this ->expectCallableOnceWith (
Original file line number Diff line number Diff line change 2
2
3
3
namespace Clue \Tests \React \Redis ;
4
4
5
- use PHPUnit \Framework \MockObject \MockBuilder ;
6
5
use PHPUnit \Framework \MockObject \MockObject ;
7
6
use PHPUnit \Framework \TestCase as BaseTestCase ;
8
7
use React \Promise \PromiseInterface ;
@@ -39,12 +38,13 @@ protected function expectCallableNever(): callable
39
38
40
39
protected function createCallableMock (): MockObject
41
40
{
42
- if (method_exists (MockBuilder::class, 'addMethods ' )) {
43
- // @phpstan-ignore-next-line requires PHPUnit 9+
44
- return $ this ->getMockBuilder (\stdClass::class)->addMethods (['__invoke ' ])->getMock ();
41
+ $ builder = $ this ->getMockBuilder (\stdClass::class);
42
+ if (method_exists ($ builder , 'addMethods ' )) {
43
+ // PHPUnit 9+
44
+ return $ builder ->addMethods (['__invoke ' ])->getMock ();
45
45
} else {
46
46
// legacy PHPUnit < 9
47
- return $ this -> getMockBuilder (\stdClass::class) ->setMethods (['__invoke ' ])->getMock ();
47
+ return $ builder ->setMethods (['__invoke ' ])->getMock ();
48
48
}
49
49
}
50
50
You can’t perform that action at this time.
0 commit comments