@@ -55,7 +55,7 @@ public function __construct(array $defaultOptions = [], int $maxHostConnections
5555 }
5656
5757 $ this ->multi = new NativeClientState ();
58- $ this ->multi ->maxHostConnections = 0 < $ maxHostConnections ? $ maxHostConnections : PHP_INT_MAX ;
58+ $ this ->multi ->maxHostConnections = 0 < $ maxHostConnections ? $ maxHostConnections : \ PHP_INT_MAX ;
5959 }
6060
6161 /**
@@ -116,7 +116,7 @@ public function request(string $method, string $url, array $options = []): Respo
116116 if ($ onProgress = $ options ['on_progress ' ]) {
117117 // Memoize the last progress to ease calling the callback periodically when no network transfer happens
118118 $ lastProgress = [0 , 0 ];
119- $ maxDuration = 0 < $ options ['max_duration ' ] ? $ options ['max_duration ' ] : INF ;
119+ $ maxDuration = 0 < $ options ['max_duration ' ] ? $ options ['max_duration ' ] : \ INF ;
120120 $ onProgress = static function (...$ progress ) use ($ onProgress , &$ lastProgress , &$ info , $ maxDuration ) {
121121 if ($ info ['total_time ' ] >= $ maxDuration ) {
122122 throw new TransportException (sprintf ('Max duration was reached for "%s". ' , implode ('' , $ info ['url ' ])));
@@ -148,11 +148,11 @@ public function request(string $method, string $url, array $options = []): Respo
148148 $ notification = static function (int $ code , int $ severity , ?string $ msg , int $ msgCode , int $ dlNow , int $ dlSize ) use ($ onProgress , &$ info ) {
149149 $ info ['total_time ' ] = microtime (true ) - $ info ['start_time ' ];
150150
151- if (STREAM_NOTIFY_PROGRESS === $ code ) {
151+ if (\ STREAM_NOTIFY_PROGRESS === $ code ) {
152152 $ info ['starttransfer_time ' ] = $ info ['starttransfer_time ' ] ?: $ info ['total_time ' ];
153153 $ info ['size_upload ' ] += $ dlNow ? 0 : $ info ['size_body ' ];
154154 $ info ['size_download ' ] = $ dlNow ;
155- } elseif (STREAM_NOTIFY_CONNECT === $ code ) {
155+ } elseif (\ STREAM_NOTIFY_CONNECT === $ code ) {
156156 $ info ['connect_time ' ] = $ info ['total_time ' ];
157157 $ info ['debug ' ] .= $ info ['request_header ' ];
158158 unset($ info ['request_header ' ]);
@@ -310,14 +310,14 @@ private static function getProxy(?string $proxy, array $url): ?array
310310 */
311311 private static function dnsResolve (array $ url , NativeClientState $ multi , array &$ info , ?\Closure $ onProgress ): array
312312 {
313- if ($ port = parse_url ($ url ['authority ' ], PHP_URL_PORT ) ?: '' ) {
313+ if ($ port = parse_url ($ url ['authority ' ], \ PHP_URL_PORT ) ?: '' ) {
314314 $ info ['primary_port ' ] = $ port ;
315315 $ port = ': ' .$ port ;
316316 } else {
317317 $ info ['primary_port ' ] = 'http: ' === $ url ['scheme ' ] ? 80 : 443 ;
318318 }
319319
320- $ host = parse_url ($ url ['authority ' ], PHP_URL_HOST );
320+ $ host = parse_url ($ url ['authority ' ], \ PHP_URL_HOST );
321321
322322 if (null === $ ip = $ multi ->dnsCache [$ host ] ?? null ) {
323323 $ info ['debug ' ] .= "* Hostname was NOT found in DNS cache \n" ;
@@ -407,7 +407,7 @@ private static function createRedirectResolver(array $options, string $host, ?ar
407407 [$ host , $ port , $ url ['authority ' ]] = self ::dnsResolve ($ url , $ multi , $ info , $ onProgress );
408408 stream_context_set_option ($ context , 'ssl ' , 'peer_name ' , $ host );
409409
410- if (false !== (parse_url ($ location , PHP_URL_HOST ) ?? false )) {
410+ if (false !== (parse_url ($ location , \ PHP_URL_HOST ) ?? false )) {
411411 // Authorization and Cookie headers MUST NOT follow except for the initial host name
412412 $ requestHeaders = $ redirectHeaders ['host ' ] === $ host ? $ redirectHeaders ['with_auth ' ] : $ redirectHeaders ['no_auth ' ];
413413 $ requestHeaders [] = 'Host: ' .$ host .$ port ;
0 commit comments