Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from league/uri 6.x to league/uri 7.x, replacing deprecated function use with new recommended ones #200

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()),
);
}
}
Loading