Skip to content

Commit

Permalink
Upgrade from league/uri 6.x to league/uri 7.x, replacing deprecated f…
Browse files Browse the repository at this point in the history
…unction use with new recommended ones
  • Loading branch information
scotteuser committed Nov 28, 2023
1 parent cc448fe commit 1f2ca92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/UsesContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/UsesUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function currentUrl(): string
*/
public function currentHost(): ?string
{
return Uri::createFromString($this->currentUrl())->getHost();
return Uri::new($this->currentUrl())->getHost();
}

/**
Expand All @@ -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();
}
Expand All @@ -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()),
);
}
}

0 comments on commit 1f2ca92

Please sign in to comment.