Skip to content

Commit d4fcb57

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
1 parent 1d06c29 commit d4fcb57

10 files changed

+150
-150
lines changed

CurlHttpClient.php

Lines changed: 66 additions & 66 deletions
Large diffs are not rendered by default.

HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function create(array $defaultOptions = [], int $maxHostConnection
3434
return new CurlHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes);
3535
}
3636

37-
@trigger_error('Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient', E_USER_WARNING);
37+
@trigger_error('Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient', \E_USER_WARNING);
3838
}
3939

4040
return new NativeHttpClient($defaultOptions, $maxHostConnections);

HttpClientTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private static function normalizeHeaders(array $headers): array
268268
private static function normalizeBody($body)
269269
{
270270
if (\is_array($body)) {
271-
return http_build_query($body, '', '&', PHP_QUERY_RFC1738);
271+
return http_build_query($body, '', '&', \PHP_QUERY_RFC1738);
272272
}
273273

274274
if ($body instanceof \Traversable) {
@@ -338,15 +338,15 @@ private static function normalizePeerFingerprint($fingerprint): array
338338
*/
339339
private static function jsonEncode($value, int $flags = null, int $maxDepth = 512): string
340340
{
341-
$flags = $flags ?? (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION);
341+
$flags = $flags ?? (\JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION);
342342

343343
try {
344-
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? JSON_THROW_ON_ERROR : 0), $maxDepth);
344+
$value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0), $maxDepth);
345345
} catch (\JsonException $e) {
346346
throw new InvalidArgumentException('Invalid value for "json" option: '.$e->getMessage());
347347
}
348348

349-
if (\PHP_VERSION_ID < 70300 && JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
349+
if (\PHP_VERSION_ID < 70300 && \JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & \JSON_PARTIAL_OUTPUT_ON_ERROR))) {
350350
throw new InvalidArgumentException('Invalid value for "json" option: '.json_last_error_msg());
351351
}
352352

@@ -441,7 +441,7 @@ private static function parseUrl(string $url, array $query = [], array $allowedS
441441
throw new InvalidArgumentException(sprintf('Unsupported IDN "%s", try enabling the "intl" PHP extension or running "composer require symfony/polyfill-intl-idn".', $host));
442442
}
443443

444-
$host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46) ?: strtolower($host) : strtolower($host);
444+
$host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, \IDNA_DEFAULT, \INTL_IDNA_VARIANT_UTS46) ?: strtolower($host) : strtolower($host);
445445
$host .= $port ? ':'.$port : '';
446446
}
447447

@@ -526,7 +526,7 @@ private static function mergeQueryString(?string $queryString, array $queryArray
526526
}
527527
}
528528

529-
$queryString = http_build_query($queryArray, '', '&', PHP_QUERY_RFC3986);
529+
$queryString = http_build_query($queryArray, '', '&', \PHP_QUERY_RFC3986);
530530
$queryArray = [];
531531

532532
if ($queryString) {

Internal/NativeClientState.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class NativeClientState extends ClientState
2323
/** @var int */
2424
public $id;
2525
/** @var int */
26-
public $maxHostConnections = PHP_INT_MAX;
26+
public $maxHostConnections = \PHP_INT_MAX;
2727
/** @var int */
2828
public $responseCount = 0;
2929
/** @var string[] */
@@ -33,6 +33,6 @@ final class NativeClientState extends ClientState
3333

3434
public function __construct()
3535
{
36-
$this->id = random_int(PHP_INT_MIN, PHP_INT_MAX);
36+
$this->id = random_int(\PHP_INT_MIN, \PHP_INT_MAX);
3737
}
3838
}

NativeHttpClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)