File tree Expand file tree Collapse file tree 9 files changed +52
-5
lines changed Expand file tree Collapse file tree 9 files changed +52
-5
lines changed Original file line number Diff line number Diff line change 2
2
/.github /workflows / export-ignore
3
3
/.gitignore export-ignore
4
4
/examples / export-ignore
5
+ /phpstan.neon.dist export-ignore
5
6
/phpunit.xml.dist export-ignore
6
7
/phpunit.xml.legacy export-ignore
7
8
/tests / export-ignore
Original file line number Diff line number Diff line change 37
37
<?php
38
38
$metrics = simplexml_load_file('clover.xml')->project->metrics;
39
39
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
40
+
41
+ PHPStan :
42
+ name : PHPStan (PHP ${{ matrix.php }})
43
+ runs-on : ubuntu-22.04
44
+ strategy :
45
+ matrix :
46
+ php :
47
+ - 8.2
48
+ - 8.1
49
+ - 8.0
50
+ - 7.4
51
+ - 7.3
52
+ - 7.2
53
+ - 7.1
54
+ steps :
55
+ - uses : actions/checkout@v3
56
+ - uses : shivammathur/setup-php@v2
57
+ with :
58
+ php-version : ${{ matrix.php }}
59
+ coverage : none
60
+ - run : composer install
61
+ - run : vendor/bin/phpstan
Original file line number Diff line number Diff line change 21
21
},
22
22
"require-dev" : {
23
23
"clue/block-react" : " ^1.5" ,
24
+ "phpstan/phpstan" : " 1.8.11 || 1.4.10" ,
24
25
"phpunit/phpunit" : " ^9.5 || ^7.5"
25
26
},
26
27
"autoload" : {
Original file line number Diff line number Diff line change
1
+ parameters:
2
+ level: 3
3
+
4
+ paths:
5
+ - examples/
6
+ - src/
7
+ - tests/
8
+
9
+ reportUnmatchedIgnoredErrors: false
10
+ ignoreErrors:
11
+ # ignore generic usage like `PromiseInterface<T>` until fixed upstream
12
+ - '/^PHPDoc tag @return contains generic type React\\Promise\\PromiseInterface<.+> but interface React\\Promise\\PromiseInterface is not generic\.$/'
13
+ # ignore undefined methods due to magic `__call()` method
14
+ - '/^Call to an undefined method Clue\\React\\Redis\\RedisClient::.+\(\)\.$/'
15
+ - '/^Call to an undefined method Clue\\React\\Redis\\Io\\StreamingClient::.+\(\)\.$/'
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ public function createClient(string $uri): PromiseInterface
91
91
$ connecting ->then (function (ConnectionInterface $ connection ) {
92
92
$ connection ->close ();
93
93
});
94
+ assert (\method_exists ($ connecting , 'cancel ' ));
94
95
$ connecting ->cancel ();
95
96
});
96
97
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class RedisClient extends EventEmitter
46
46
/** @var float */
47
47
private $ idlePeriod = 0.001 ;
48
48
49
- /** @var ?TimerInterface */
49
+ /** @var ?\React\EventLoop\ TimerInterface */
50
50
private $ idleTimer = null ;
51
51
52
52
/** @var int */
@@ -221,6 +221,7 @@ public function close(): void
221
221
$ redis ->close ();
222
222
});
223
223
if ($ this ->promise !== null ) {
224
+ assert (\method_exists ($ this ->promise , 'cancel ' ));
224
225
$ this ->promise ->cancel ();
225
226
$ this ->promise = null ;
226
227
}
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ public function testInvalidCommand()
106
106
if (method_exists ($ this , 'expectException ' )) {
107
107
$ this ->expectException ('Exception ' );
108
108
} else {
109
+ assert (method_exists ($ this , 'setExpectedException ' ));
109
110
$ this ->setExpectedException ('Exception ' );
110
111
}
111
112
await ($ promise , $ this ->loop );
Original file line number Diff line number Diff line change @@ -444,6 +444,8 @@ public function testCancelWillRejectPromise()
444
444
$ this ->connector ->expects ($ this ->once ())->method ('connect ' )->with ('127.0.0.1:2 ' )->willReturn ($ promise );
445
445
446
446
$ promise = $ this ->factory ->createClient ('redis://127.0.0.1:2 ' );
447
+
448
+ assert (method_exists ($ promise , 'cancel ' ));
447
449
$ promise ->cancel ();
448
450
449
451
$ promise ->then (null , $ this ->expectCallableOnceWith ($ this ->isInstanceOf (\RuntimeException::class)));
@@ -526,6 +528,8 @@ public function testCancelWillRejectWithUriInMessageAndCancelConnectorWhenConnec
526
528
$ this ->connector ->expects ($ this ->once ())->method ('connect ' )->willReturn ($ deferred ->promise ());
527
529
528
530
$ promise = $ this ->factory ->createClient ($ uri );
531
+
532
+ assert (method_exists ($ promise , 'cancel ' ));
529
533
$ promise ->cancel ();
530
534
531
535
$ promise ->then (null , $ this ->expectCallableOnceWith (
@@ -550,6 +554,8 @@ public function testCancelWillCloseConnectionWhenConnectionWaitsForSelect()
550
554
$ this ->connector ->expects ($ this ->once ())->method ('connect ' )->willReturn (resolve ($ stream ));
551
555
552
556
$ promise = $ this ->factory ->createClient ('redis://127.0.0.1:2/123 ' );
557
+
558
+ assert (method_exists ($ promise , 'cancel ' ));
553
559
$ promise ->cancel ();
554
560
555
561
$ promise ->then (null , $ this ->expectCallableOnceWith (
Original file line number Diff line number Diff line change @@ -356,11 +356,10 @@ public function testCloseAfterPingRejectsWillEmitClose()
356
356
$ this ->loop ->expects ($ this ->once ())->method ('addTimer ' )->willReturn ($ timer );
357
357
$ this ->loop ->expects ($ this ->once ())->method ('cancelTimer ' )->with ($ timer );
358
358
359
- $ ref = $ this ->redis ;
360
- $ ref ->ping ()->then (null , function () use ($ ref , $ client ) {
361
- $ ref ->close ();
359
+ $ this ->redis ->ping ()->then (null , function () {
360
+ $ this ->redis ->close ();
362
361
});
363
- $ ref ->on ('close ' , $ this ->expectCallableOnce ());
362
+ $ this -> redis ->on ('close ' , $ this ->expectCallableOnce ());
364
363
$ deferred ->reject (new \RuntimeException ());
365
364
}
366
365
You can’t perform that action at this time.
0 commit comments