Skip to content

Commit

Permalink
[BrowserKit] Use strict comparison when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
BafS committed May 6, 2022
1 parent 115bad0 commit b839cef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions AbstractBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function isFollowingRedirects(): bool
public function setMaxRedirects(int $maxRedirects)
{
$this->maxRedirects = $maxRedirects < 0 ? -1 : $maxRedirects;
$this->followRedirects = -1 != $this->maxRedirects;
$this->followRedirects = -1 !== $this->maxRedirects;
}

/**
Expand Down Expand Up @@ -354,7 +354,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
$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 @@ -623,7 +623,7 @@ protected function getAbsoluteUri(string $uri): string
}

// anchor or query string parameters?
if (!$uri || '#' == $uri[0] || '?' == $uri[0]) {
if (!$uri || '#' === $uri[0] || '?' === $uri[0]) {
return preg_replace('/[#?].*?$/', '', $currentUri).$uri;
}

Expand Down Expand Up @@ -654,7 +654,7 @@ private function updateServerFromUri(array $server, string $uri): array
{
$server['HTTP_HOST'] = $this->extractHost($uri);
$scheme = parse_url($uri, \PHP_URL_SCHEME);
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' == $scheme;
$server['HTTPS'] = null === $scheme ? $server['HTTPS'] : 'https' === $scheme;
unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']);

return $server;
Expand Down
2 changes: 1 addition & 1 deletion Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static function fromString(string $cookie, string $url = null): static

if ('secure' === strtolower($part)) {
// Ignore the secure flag if the original URI is not given or is not HTTPS
if (!$url || !isset($urlParts['scheme']) || 'https' != $urlParts['scheme']) {
if (!$url || !isset($urlParts['scheme']) || 'https' !== $urlParts['scheme']) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function allValues(string $uri, bool $returnsRawValue = false): array
}

foreach ($namedCookies as $cookie) {
if ($cookie->isSecure() && 'https' != $parts['scheme']) {
if ($cookie->isSecure() && 'https' !== $parts['scheme']) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions History.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function add(Request $request)
*/
public function isEmpty(): bool
{
return 0 == \count($this->stack);
return 0 === \count($this->stack);
}

/**
Expand Down Expand Up @@ -83,7 +83,7 @@ public function forward(): Request
*/
public function current(): Request
{
if (-1 == $this->position) {
if (-1 === $this->position) {
throw new \LogicException('The page history is empty.');
}

Expand Down

0 comments on commit b839cef

Please sign in to comment.