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 1212 ],
1313 "require" : {
1414 "php" : " >=5.3" ,
15- "react/promise" : " ^3 || ^2.1 || ^1.2.1" ,
16- "react/socket" : " ^1.12 " ,
15+ "react/promise" : " ^3.2 || ^2.1 || ^1.2.1" ,
16+ "react/socket" : " ^1.16 " ,
1717 "ringcentral/psr7" : " ^1.2"
1818 },
1919 "require-dev" : {
2020 "phpunit/phpunit" : " ^9.6 || ^5.7 || ^4.8.36" ,
21- "react/async" : " ^4 || ^3 || ^2" ,
21+ "react/async" : " ^4.3 || ^3 || ^2" ,
2222 "react/event-loop" : " ^1.2" ,
23- "react/http" : " ^1.5 " ,
24- "react/promise-timer" : " ^1.10 "
23+ "react/http" : " ^1.11 " ,
24+ "react/promise-timer" : " ^1.11 "
2525 },
2626 "autoload" : {
2727 "psr-4" : {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ class ProxyConnector implements ConnectorInterface
6060 public function __construct (
6161 #[\SensitiveParameter]
6262 $ proxyUrl ,
63- ConnectorInterface $ connector = null ,
63+ $ connector = null ,
6464 array $ httpHeaders = array ()
6565 ) {
6666 // support `http+unix://` scheme for Unix domain socket (UDS) paths
@@ -84,6 +84,10 @@ public function __construct(
8484 throw new InvalidArgumentException ('Invalid proxy URL " ' . $ proxyUrl . '" ' );
8585 }
8686
87+ if ($ connector !== null && !$ connector instanceof ConnectorInterface) { // manual type check to support legacy PHP < 7.1
88+ throw new \InvalidArgumentException ('Argument #2 ($connector) expected null|React\Socket\ConnectorInterface ' );
89+ }
90+
8791 // apply default port and TCP/TLS transport for given scheme
8892 if (!isset ($ parts ['port ' ])) {
8993 $ parts ['port ' ] = $ parts ['scheme ' ] === 'https ' ? 443 : 80 ;
Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ public function testInvalidHttpsUnixScheme()
4848 new ProxyConnector ('https+unix:///tmp/proxy.sock ' , $ this ->connector );
4949 }
5050
51+ public function testContructorThrowsExceptionForInvalidConnector ()
52+ {
53+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #2 ($connector) expected null|React\Socket\ConnectorInterface ' );
54+ new ProxyConnector ('proxy.example.com ' , 'connector ' );
55+ }
56+
5157 public function testCreatesConnectionToHttpPort ()
5258 {
5359 $ promise = new Promise (function () { });
You can’t perform that action at this time.
0 commit comments