File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 77jobs :
88 PHPUnit :
99 name : PHPUnit (PHP ${{ matrix.php }})
10- runs-on : ubuntu-22 .04
10+ runs-on : ubuntu-24 .04
1111 strategy :
1212 matrix :
1313 php :
14+ - 8.4
1415 - 8.3
1516 - 8.2
1617 - 8.1
3839
3940 PHPUnit-hhvm :
4041 name : PHPUnit (HHVM)
41- runs-on : ubuntu-22 .04
42+ runs-on : ubuntu-24 .04
4243 continue-on-error : true
4344 steps :
4445 - uses : actions/checkout@v4
Original file line number Diff line number Diff line change 2424 "php" : " >=5.3" ,
2525 "clue/multicast-react" : " ^1.0 || ^0.2" ,
2626 "react/event-loop" : " ^1.2" ,
27- "react/promise" : " ^2.0 || ^1.0 "
27+ "react/promise" : " ^3.2 || ^2.7 || ^1.2.1 "
2828 },
2929 "require-dev" : {
3030 "phpunit/phpunit" : " ^9.6 || ^5.7 || ^4.8.36"
Original file line number Diff line number Diff line change @@ -28,8 +28,12 @@ class Client
2828 * @param ?LoopInterface $loop
2929 * @param ?MulticastFactory $multicast
3030 */
31- public function __construct (LoopInterface $ loop = null , MulticastFactory $ multicast = null )
31+ public function __construct ($ loop = null , MulticastFactory $ multicast = null )
3232 {
33+ if ($ loop !== null && !$ loop instanceof LoopInterface) { // manual type check to support legacy PHP < 7.1
34+ throw new \InvalidArgumentException ('Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
35+ }
36+
3337 $ this ->loop = $ loop ?: Loop::get ();
3438 $ this ->multicast = $ multicast ?: new MulticastFactory ($ this ->loop );
3539 }
Original file line number Diff line number Diff line change @@ -71,4 +71,19 @@ public function testSearchTimeout()
7171
7272 $ promise ->then ($ this ->expectCallableOnce (), $ this ->expectCallableNever (), $ this ->expectCallableNever ());
7373 }
74+
75+ public function testCtorThrowsForInvalidLoop ()
76+ {
77+ if (method_exists ($ this , 'expectException ' )) {
78+ // PHPUnit 5.2+
79+ $ this ->expectException ('InvalidArgumentException ' );
80+ $ this ->expectExceptionMessage ('Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
81+ } else {
82+ // legacy PHPUnit
83+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
84+ }
85+
86+ new Client ('loop ' );
87+ }
88+
7489}
You can’t perform that action at this time.
0 commit comments