Skip to content

Commit 8cbcf7d

Browse files
committed
Leverage str_ends_with
added the php80 polyfill to requirements when necessary
1 parent 729b1f0 commit 8cbcf7d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ protected function getAbsoluteUri($uri)
688688
if ('/' !== $uri[0]) {
689689
$path = parse_url($currentUri, \PHP_URL_PATH);
690690

691-
if ('/' !== substr($path, -1)) {
691+
if (!str_ends_with($path, '/')) {
692692
$path = substr($path, 0, strrpos($path, '/') + 1);
693693
}
694694

CookieJar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function get($name, $path = '/', $domain = null)
4646
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
4747
if ($cookieDomain && $domain) {
4848
$cookieDomain = '.'.ltrim($cookieDomain, '.');
49-
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
49+
if (!str_ends_with('.'.$domain, $cookieDomain)) {
5050
continue;
5151
}
5252
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=7.1.3",
20-
"symfony/dom-crawler": "^3.4|^4.0|^5.0"
20+
"symfony/dom-crawler": "^3.4|^4.0|^5.0",
21+
"symfony/polyfill-php80": "^1.16"
2122
},
2223
"require-dev": {
2324
"symfony/css-selector": "^3.4|^4.0|^5.0",

0 commit comments

Comments
 (0)