Skip to content

Commit 45e3304

Browse files
Merge branch '5.4' into 6.0
* 5.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 8431435 + a0aad54 commit 45e3304

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function fromString(string $cookie, string $url = null)
127127
{
128128
$parts = explode(';', $cookie);
129129

130-
if (false === strpos($parts[0], '=')) {
130+
if (!str_contains($parts[0], '=')) {
131131
throw new \InvalidArgumentException(sprintf('The cookie string "%s" is not valid.', $parts[0]));
132132
}
133133

CookieJar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ public function get(string $name, string $path = '/', string $domain = null)
4242
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
4343
if ($cookieDomain && $domain) {
4444
$cookieDomain = '.'.ltrim($cookieDomain, '.');
45-
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
45+
if (!str_ends_with('.'.$domain, $cookieDomain)) {
4646
continue;
4747
}
4848
}
4949

5050
foreach ($pathCookies as $cookiePath => $namedCookies) {
51-
if (0 !== strpos($path, $cookiePath)) {
51+
if (!str_starts_with($path, $cookiePath)) {
5252
continue;
5353
}
5454
if (isset($namedCookies[$name])) {

HttpBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function getHeaders(Request $request): array
100100
foreach ($request->getServer() as $key => $value) {
101101
$key = strtolower(str_replace('_', '-', $key));
102102
$contentHeaders = ['content-length' => true, 'content-md5' => true, 'content-type' => true];
103-
if (0 === strpos($key, 'http-')) {
103+
if (str_starts_with($key, 'http-')) {
104104
$headers[substr($key, 5)] = $value;
105105
} elseif (isset($contentHeaders[$key])) {
106106
// CONTENT_* are not prefixed with HTTP_

0 commit comments

Comments
 (0)