File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1414 "php" : " >=5.3" ,
1515 "clue/json-stream" : " ^0.1" ,
1616 "react/event-loop" : " ^1.2" ,
17- "react/http" : " ^1.8 " ,
18- "react/promise" : " ^3.1 || ^2.11 || ^1.3" ,
17+ "react/http" : " ^1.11 " ,
18+ "react/promise" : " ^3.2 || ^2.11 || ^1.3" ,
1919 "react/promise-stream" : " ^1.6" ,
20- "react/socket" : " ^1.12 " ,
21- "react/stream" : " ^1.2 " ,
20+ "react/socket" : " ^1.16 " ,
21+ "react/stream" : " ^1.4 " ,
2222 "rize/uri-template" : " ^0.3"
2323 },
2424 "require-dev" : {
2525 "clue/caret-notation" : " ^0.2" ,
2626 "clue/tar-react" : " ^0.2" ,
2727 "phpunit/phpunit" : " ^9.6 || ^5.7 || ^4.8.36" ,
28- "react/async" : " ^4 || ^3 || ^2"
28+ "react/async" : " ^4.2 || ^3 || ^2"
2929 },
3030 "autoload" : {
3131 "psr-4" : {
Original file line number Diff line number Diff line change @@ -56,8 +56,12 @@ class Client
5656 * @param ?string $url
5757 * @throws \InvalidArgumentException
5858 */
59- public function __construct (LoopInterface $ loop = null , $ url = null )
59+ public function __construct ($ loop = null , $ url = null )
6060 {
61+ if ($ loop !== null && !$ loop instanceof LoopInterface) { // manual type check to support legacy PHP < 7.1
62+ throw new \InvalidArgumentException ('Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
63+ }
64+
6165 if ($ url === null ) {
6266 $ url = 'unix:///var/run/docker.sock ' ;
6367 }
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ public function testCtorWithLoop()
5959 new Client ($ loop );
6060 }
6161
62+ public function testCtorThrowsForInvalidLoop ()
63+ {
64+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
65+ new Client ('loop ' );
66+ }
67+
6268 public function testCtorWithInvalidUrlThrows ()
6369 {
6470 $ this ->setExpectedException ('InvalidArgumentException ' );
You can’t perform that action at this time.
0 commit comments