From 1f2ca9218941053515972b37668f95cc4d2efaa2 Mon Sep 17 00:00:00 2001 From: Scott Euser Date: Tue, 28 Nov 2023 20:17:21 +0000 Subject: [PATCH] Upgrade from league/uri 6.x to league/uri 7.x, replacing deprecated function use with new recommended ones --- composer.json | 2 +- src/UsesContent.php | 2 +- src/UsesUrls.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index c1cda80..b7a1064 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "ext-intl": "*", "symfony/dom-crawler": "^5.4 || ^6.0", "donatello-za/rake-php-plus": "^1.0.15", - "league/uri": "^6.0", + "league/uri": "^7.0", "symfony/browser-kit": "^6.0", "symfony/http-client": "^6.0", "symfony/css-selector": "^6.0" diff --git a/src/UsesContent.php b/src/UsesContent.php index a1a64bc..25697c2 100644 --- a/src/UsesContent.php +++ b/src/UsesContent.php @@ -448,7 +448,7 @@ public function internalLinks(): array return array_values(array_filter( $this->links(), function ($link) use (&$currentRootDomain): bool { - $linkRootDomain = Uri::createFromString($link)->getHost(); + $linkRootDomain = Uri::new($link)->getHost(); return $currentRootDomain === $linkRootDomain; } diff --git a/src/UsesUrls.php b/src/UsesUrls.php index dceae2d..a7df9d9 100644 --- a/src/UsesUrls.php +++ b/src/UsesUrls.php @@ -32,7 +32,7 @@ public function currentUrl(): string */ public function currentHost(): ?string { - return Uri::createFromString($this->currentUrl())->getHost(); + return Uri::new($this->currentUrl())->getHost(); } /** @@ -42,7 +42,7 @@ public function currentHost(): ?string */ public function currentBaseHost(): string { - $uri = Uri::createFromString($this->baseHref() ?? $this->currentUrl()); + $uri = Uri::new($this->baseHref() ?? $this->currentUrl()); return $uri->getScheme() . '://' . $uri->getHost(); } @@ -61,8 +61,8 @@ public function makeUrlAbsolute(string $url = null, string $baseUrl = null): ?st // Resolve the Url using one of the provided/set base href. return (string) UriResolver::resolve( - Http::createFromString($url), - Http::createFromString($baseUrl ?? $this->baseHref() ?? $this->currentBaseHost()), + Http::new($url), + Http::new($baseUrl ?? $this->baseHref() ?? $this->currentBaseHost()), ); } }