Skip to content

Commit c79ee0c

Browse files
committed
Address more deprecations
1 parent fa2fd83 commit c79ee0c

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

packages/guides/src/ParserContext.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
namespace phpDocumentor\Guides;
1515

1616
use League\Flysystem\FilesystemInterface;
17-
use League\Uri\Uri;
18-
use League\Uri\UriInfo;
17+
use League\Uri\BaseUri;
1918
use phpDocumentor\FileSystem\FileSystem;
2019
use phpDocumentor\Guides\Nodes\ProjectNode;
2120
use phpDocumentor\Guides\ReferenceResolvers\DocumentNameResolverInterface;
@@ -47,8 +46,7 @@ public function getInitialHeaderLevel(): int
4746

4847
public function absoluteRelativePath(string $url): string
4948
{
50-
$uri = Uri::createFromString($url);
51-
if (UriInfo::isAbsolutePath($uri)) {
49+
if (BaseUri::from($url)->isAbsolutePath()) {
5250
return $this->currentDirectory . '/' . ltrim($url, '/');
5351
}
5452

packages/guides/src/ReferenceResolvers/DocumentNameResolver.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
namespace phpDocumentor\Guides\ReferenceResolvers;
1515

16-
use League\Uri\UriInfo;
17-
use phpDocumentor\Guides\UriFactory;
16+
use League\Uri\BaseUri;
1817

1918
use function array_pop;
2019
use function explode;
@@ -32,13 +31,12 @@ final class DocumentNameResolver implements DocumentNameResolverInterface
3231
*/
3332
public function absoluteUrl(string $basePath, string $url): string
3433
{
35-
$uri = UriFactory::createUri($url);
36-
37-
if (UriInfo::isAbsolute($uri)) {
34+
$uri = BaseUri::from($url);
35+
if ($uri->isAbsolute()) {
3836
return $url;
3937
}
4038

41-
if (UriInfo::isAbsolutePath($uri)) {
39+
if ($uri->isAbsolutePath()) {
4240
return $url;
4341
}
4442

packages/guides/src/Renderer/UrlGenerator/AbstractUrlGenerator.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
namespace phpDocumentor\Guides\Renderer\UrlGenerator;
1515

1616
use Exception;
17-
use League\Uri\UriInfo;
17+
use League\Uri\BaseUri;
1818
use phpDocumentor\Guides\ReferenceResolvers\DocumentNameResolverInterface;
1919
use phpDocumentor\Guides\RenderContext;
20-
use phpDocumentor\Guides\UriFactory;
2120

2221
use function filter_var;
2322
use function sprintf;
@@ -84,9 +83,7 @@ public function generateInternalUrl(
8483

8584
private function isRelativeUrl(string $url): bool
8685
{
87-
$uri = UriFactory::createUri($url);
88-
89-
return UriInfo::isRelativePath($uri);
86+
return BaseUri::from($url)->isRelativePath();
9087
}
9188

9289
public function getCurrentFileUrl(RenderContext $renderContext): string

packages/guides/src/Renderer/UrlGenerator/RelativeUrlGenerator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function generateInternalPathFromRelativeUrl(
3030
RenderContext $renderContext,
3131
string $canonicalUrl,
3232
): string {
33-
$currentPathUri = Uri::createFromString($renderContext->getOutputFilePath());
34-
$canonicalUrlUri = Uri::createFromString($canonicalUrl);
33+
$currentPathUri = Uri::new($renderContext->getOutputFilePath());
34+
$canonicalUrlUri = Uri::new($canonicalUrl);
3535

3636
$canonicalAnchor = $canonicalUrlUri->getFragment();
3737

packages/guides/src/Twig/AssetsExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace phpDocumentor\Guides\Twig;
1515

16+
use League\Uri\BaseUri;
1617
use League\Uri\Uri;
17-
use League\Uri\UriInfo;
1818
use phpDocumentor\Guides\Meta\InternalTarget;
1919
use phpDocumentor\Guides\Meta\Target;
2020
use phpDocumentor\Guides\NodeRenderers\NodeRenderer;
@@ -79,7 +79,7 @@ public function getTests(): array
7979
),
8080
new TwigTest(
8181
'external_target',
82-
static fn (string|Stringable $value): bool => UriInfo::isAbsolute(Uri::createFromString($value)),
82+
static fn (string|Stringable $value): bool => BaseUri::from(Uri::new($value))->isAbsolute(),
8383
),
8484
];
8585
}

packages/guides/src/UriFactory.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public static function createUri(string $uriString): UriInterface
4646
$uriString = substr($uriString, strlen('file:///'));
4747
}
4848

49-
return LeagueUri::createFromWindowsPath($uriString);
49+
return LeagueUri::fromWindowsPath($uriString);
5050
}
5151

52-
return LeagueUri::createFromString($uriString);
52+
return LeagueUri::new($uriString);
5353
} catch (Throwable $exception) {
5454
throw new InvalidArgumentException(
5555
sprintf(
@@ -70,7 +70,7 @@ private static function createPharUri(string $uriString): UriInterface
7070
$path = '/' . $path;
7171
}
7272

73-
return LeagueUri::createFromComponents(
73+
return LeagueUri::fromComponents(
7474
[
7575
'scheme' => 'phar',
7676
'host' => '',

phpunit-baseline.xml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0"?>
22
<files version="1">
3+
<file path="packages/filesystem/Flysystem/FilesystemInterface.php">
4+
<line number="286" hash="e2010bb2ff8572975ea792898ad31f72ea87a511">
5+
<issue><![CDATA[League\Flysystem\FilesystemInterface::get(): Implicitly marking parameter $handler as nullable is deprecated, the explicit nullable type must be used instead]]></issue>
6+
</line>
7+
</file>
38
<file path="vendor/league/flysystem/src/FilesystemInterface.php">
49
<line number="274" hash="974a66e314c847f29d4b178ad6b47395be68d98f">
510
<issue><![CDATA[League\Flysystem\FilesystemInterface::get(): Implicitly marking parameter $handler as nullable is deprecated, the explicit nullable type must be used instead]]></issue>

0 commit comments

Comments
 (0)