Skip to content

Commit

Permalink
Enable "native_constant_invocation" CS rule
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Sep 2, 2020
1 parent 1467e0c commit 2084c70
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ public function request($method, $uri, array $parameters = [], array $files = []

$server = array_merge($this->server, $server);

if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, PHP_URL_HOST)) {
if (!empty($server['HTTP_HOST']) && null === parse_url($originalUri, \PHP_URL_HOST)) {
$uri = preg_replace('{^(https?\://)'.preg_quote($this->extractHost($uri)).'}', '${1}'.$server['HTTP_HOST'], $uri);
}

if (isset($server['HTTPS']) && null === parse_url($originalUri, PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
if (isset($server['HTTPS']) && null === parse_url($originalUri, \PHP_URL_SCHEME)) {
$uri = preg_replace('{^'.parse_url($uri, \PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
}

if (!isset($server['HTTP_REFERER']) && !$this->history->isEmpty()) {
Expand All @@ -302,7 +302,7 @@ public function request($method, $uri, array $parameters = [], array $files = []
$server['HTTP_HOST'] = $this->extractHost($uri);
}

$server['HTTPS'] = 'https' == parse_url($uri, PHP_URL_SCHEME);
$server['HTTPS'] = 'https' == parse_url($uri, \PHP_URL_SCHEME);

$this->internalRequest = new Request($uri, $method, $parameters, $files, $this->cookieJar->allValues($uri), $server, $content);

Expand Down Expand Up @@ -362,9 +362,9 @@ protected function doRequestInProcess($request)
foreach ($deprecations ? unserialize($deprecations) : [] as $deprecation) {
if ($deprecation[0]) {
// unsilenced on purpose
trigger_error($deprecation[1], E_USER_DEPRECATED);
trigger_error($deprecation[1], \E_USER_DEPRECATED);
} else {
@trigger_error($deprecation[1], E_USER_DEPRECATED);
@trigger_error($deprecation[1], \E_USER_DEPRECATED);
}
}
}
Expand Down Expand Up @@ -569,7 +569,7 @@ protected function getAbsoluteUri($uri)

// protocol relative URL
if (0 === strpos($uri, '//')) {
return parse_url($currentUri, PHP_URL_SCHEME).':'.$uri;
return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri;
}

// anchor or query string parameters?
Expand All @@ -578,7 +578,7 @@ protected function getAbsoluteUri($uri)
}

if ('/' !== $uri[0]) {
$path = parse_url($currentUri, PHP_URL_PATH);
$path = parse_url($currentUri, \PHP_URL_PATH);

if ('/' !== substr($path, -1)) {
$path = substr($path, 0, strrpos($path, '/') + 1);
Expand Down Expand Up @@ -606,7 +606,7 @@ protected function requestFromRequest(Request $request, $changeHistory = true)
private function updateServerFromUri($server, $uri)
{
$server['HTTP_HOST'] = $this->extractHost($uri);
$scheme = parse_url($uri, PHP_URL_SCHEME);
$scheme = parse_url($uri, \PHP_URL_SCHEME);
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);

Expand All @@ -615,9 +615,9 @@ private function updateServerFromUri($server, $uri)

private function extractHost($uri)
{
$host = parse_url($uri, PHP_URL_HOST);
$host = parse_url($uri, \PHP_URL_HOST);

if ($port = parse_url($uri, PHP_URL_PORT)) {
if ($port = parse_url($uri, \PHP_URL_PORT)) {
return $host.':'.$port;
}

Expand Down

0 comments on commit 2084c70

Please sign in to comment.