Skip to content

Commit a6cacf1

Browse files
committed
Adding PHP8.4 support and Deprecated attribute
1 parent 3cb4b43 commit a6cacf1

28 files changed

+136
-65
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ jobs:
1010
runs-on: ubuntu-20.04
1111
strategy:
1212
matrix:
13-
php: ['8.1', '8.2', '8.3']
13+
php: ['8.1', '8.2', '8.3', '8.4']
1414
stability: [prefer-lowest, prefer-stable]
15-
include:
16-
- php: '8.4'
17-
flags: "--ignore-platform-req=php"
18-
phpunit-flags: '--no-coverage'
19-
stability: prefer-stable
2015
steps:
2116
- name: Checkout code
2217
uses: actions/checkout@v3
@@ -50,11 +45,7 @@ jobs:
5045

5146
- name: Run Unit tests with coverage
5247
run: composer phpunit -- ${{ matrix.phpunit-flags }}
53-
if: ${{ matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' }}
54-
55-
- name: Run Unit tests without coverage
56-
run: composer phpunit:min
57-
if: ${{ matrix.php == '8.4'}}
48+
if: ${{ matrix.php == '8.4' || matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' }}
5849

5950
- name: Run static analysis
6051
run: composer phpstan

components/Components/Authority.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use League\Uri\Contracts\AuthorityInterface;
1718
use League\Uri\Contracts\HostInterface;
1819
use League\Uri\Contracts\PortInterface;
@@ -200,6 +201,7 @@ public function withUserInfo(Stringable|string|null $user, #[SensitiveParameter]
200201
*
201202
* Create a new instance from a URI object.
202203
*/
204+
#[Deprecated(message:'use League\Uri\Components\Authority::fromUri() instead', since:'league/uri-components:7.0.0')]
203205
public static function createFromUri(UriInterface|Psr7UriInterface $uri): self
204206
{
205207
return self::fromUri($uri);
@@ -215,6 +217,7 @@ public static function createFromUri(UriInterface|Psr7UriInterface $uri): self
215217
*
216218
* Returns a new instance from a string or a stringable object.
217219
*/
220+
#[Deprecated(message:'use League\Uri\Components\Authority::new() instead', since:'league/uri-components:7.0.0')]
218221
public static function createFromString(Stringable|string $authority): self
219222
{
220223
return self::new($authority);
@@ -230,6 +233,7 @@ public static function createFromString(Stringable|string $authority): self
230233
*
231234
* Returns a new instance from null.
232235
*/
236+
#[Deprecated(message:'use League\Uri\Components\Authority::new() instead', since:'league/uri-components:7.0.0')]
233237
public static function createFromNull(): self
234238
{
235239
return self::new();
@@ -255,6 +259,7 @@ public static function createFromNull(): self
255259
* port? : ?int
256260
* } $components
257261
*/
262+
#[Deprecated(message:'use League\Uri\Components\Authority::fromComponents() instead', since:'league/uri-components:7.0.0')]
258263
public static function createFromComponents(array $components): self
259264
{
260265
return self::fromComponents($components);

components/Components/DataPath.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use finfo;
1718
use League\Uri\Contracts\DataPathInterface;
1819
use League\Uri\Contracts\PathInterface;
@@ -380,6 +381,7 @@ public function withParameters(Stringable|string $parameters): DataPathInterface
380381
*
381382
* Returns a new instance from a string or a stringable object.
382383
*/
384+
#[Deprecated(message:'use League\Uri\Components\DataPath::new() instead', since:'league/uri-components:7.0.0')]
383385
public static function createFromString(Stringable|string $path): self
384386
{
385387
return self::new($path);
@@ -399,6 +401,7 @@ public static function createFromString(Stringable|string $path): self
399401
*
400402
* @throws SyntaxError If the File is not readable
401403
*/
404+
#[Deprecated(message:'use League\Uri\Components\DataPath::fromFilePath() instead', since:'league/uri-components:7.0.0')]
402405
public static function createFromFilePath(string $path, $context = null): self
403406
{
404407
return self::fromFileContents($path, $context);
@@ -414,6 +417,7 @@ public static function createFromFilePath(string $path, $context = null): self
414417
*
415418
* Create a new instance from a URI object.
416419
*/
420+
#[Deprecated(message:'use League\Uri\Components\DataPath::fromUri() instead', since:'league/uri-components:7.0.0')]
417421
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
418422
{
419423
return self::fromUri($uri);

components/Components/Domain.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use Iterator;
1718
use League\Uri\Contracts\AuthorityInterface;
1819
use League\Uri\Contracts\DomainHostInterface;
@@ -304,6 +305,7 @@ public function withoutLabel(int ...$keys): DomainHostInterface
304305
*
305306
* Returns a new instance from a string or a stringable object.
306307
*/
308+
#[Deprecated(message:'use League\Uri\Components\Domain::getIterator() instead', since:'league/uri-components:7.0.0')]
307309
public function labels(): array
308310
{
309311
return $this->labels;
@@ -319,6 +321,7 @@ public function labels(): array
319321
*
320322
* Returns a new instance from a string or a stringable object.
321323
*/
324+
#[Deprecated(message:'use League\Uri\Components\Domain::new() instead', since:'league/uri-components:7.0.0')]
322325
public static function createFromString(Stringable|string $host): self
323326
{
324327
return self::new($host);
@@ -336,6 +339,7 @@ public static function createFromString(Stringable|string $host): self
336339
*
337340
* @throws TypeError If a label is the null value
338341
*/
342+
#[Deprecated(message:'use League\Uri\Components\Domain::fromLabels() instead', since:'league/uri-components:7.0.0')]
339343
public static function createFromLabels(iterable $labels): self
340344
{
341345
return self::fromLabels(...$labels);
@@ -351,6 +355,7 @@ public static function createFromLabels(iterable $labels): self
351355
*
352356
* Create a new instance from a URI object.
353357
*/
358+
#[Deprecated(message:'use League\Uri\Components\Domain::fromUri() instead', since:'league/uri-components:7.0.0')]
354359
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
355360
{
356361
return self::fromUri($uri);
@@ -366,6 +371,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
366371
*
367372
* Create a new instance from an Authority object.
368373
*/
374+
#[Deprecated(message:'use League\Uri\Components\Domain::fromAuthority() instead', since:'league/uri-components:7.0.0')]
369375
public static function createFromAuthority(AuthorityInterface|Stringable|string $authority): self
370376
{
371377
return self::fromAuthority($authority);
@@ -381,6 +387,7 @@ public static function createFromAuthority(AuthorityInterface|Stringable|string
381387
*
382388
* Returns a new instance from an iterable structure.
383389
*/
390+
#[Deprecated(message:'use League\Uri\Components\Domain::new() instead', since:'league/uri-components:7.0.0')]
384391
public static function createFromHost(HostInterface $host): self
385392
{
386393
return self::new($host);

components/Components/Fragment.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use League\Uri\Contracts\FragmentInterface;
1718
use League\Uri\Contracts\UriInterface;
1819
use League\Uri\Encoder;
@@ -76,6 +77,7 @@ public function decoded(): ?string
7677
*
7778
* @codeCoverageIgnore
7879
*/
80+
#[Deprecated(message:'use League\Uri\Components\Fragment::new() instead', since:'league/uri-components:7.0.0')]
7981
public static function createFromString(Stringable|string $fragment): self
8082
{
8183
return self::new($fragment);
@@ -91,6 +93,7 @@ public static function createFromString(Stringable|string $fragment): self
9193
*
9294
* Create a new instance from a URI object.
9395
*/
96+
#[Deprecated(message:'use League\Uri\Components\Fragment::fromUri() instead', since:'league/uri-components:7.0.0')]
9497
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
9598
{
9699
return self::fromUri($uri);

components/Components/HierarchicalPath.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use Iterator;
1718
use League\Uri\Contracts\PathInterface;
1819
use League\Uri\Contracts\SegmentedPathInterface;
@@ -447,12 +448,13 @@ private function buildBasename(string $extension, string $ext, ?string $param =
447448
* DEPRECATION WARNING! This method will be removed in the next major point release.
448449
*
449450
* @deprecated Since version 7.0.0
450-
* @see Domain::getIterator()
451+
* @see HierarchicalPath::getIterator()
451452
*
452453
* @codeCoverageIgnore
453454
*
454455
* Returns a new instance from a string or a stringable object.
455456
*/
457+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::getIterator() instead', since:'league/uri-components:7.0.0')]
456458
public function segments(): array
457459
{
458460
return $this->segments;
@@ -468,6 +470,7 @@ public function segments(): array
468470
*
469471
* Returns a new instance from a string or a stringable object.
470472
*/
473+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
471474
public static function createFromString(Stringable|string $path): self
472475
{
473476
return self::new($path);
@@ -481,6 +484,7 @@ public static function createFromString(Stringable|string $path): self
481484
*
482485
* @codeCoverageIgnore
483486
*/
487+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
484488
public static function createFromPath(PathInterface $path): self
485489
{
486490
return self::new($path);
@@ -498,6 +502,7 @@ public static function createFromPath(PathInterface $path): self
498502
*
499503
* @deprecated Since version 7.0.0
500504
*/
505+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromRelative() instead', since:'league/uri-components:7.0.0')]
501506
public static function createRelativeFromSegments(iterable $segments): self
502507
{
503508
return self::fromRelative(...$segments);
@@ -515,6 +520,7 @@ public static function createRelativeFromSegments(iterable $segments): self
515520
*
516521
* @deprecated Since version 7.0.0
517522
*/
523+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromAbsolute() instead', since:'league/uri-components:7.0.0')]
518524
public static function createAbsoluteFromSegments(iterable $segments): self
519525
{
520526
return self::fromAbsolute(...$segments);
@@ -530,6 +536,7 @@ public static function createAbsoluteFromSegments(iterable $segments): self
530536
*
531537
* Create a new instance from a URI object.
532538
*/
539+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromUri() instead', since:'league/uri-components:7.0.0')]
533540
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
534541
{
535542
return self::fromUri($uri);

components/Components/Host.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use League\Uri\Contracts\AuthorityInterface;
1718
use League\Uri\Contracts\IpHostInterface;
1819
use League\Uri\Contracts\UriInterface;
@@ -415,6 +416,7 @@ public function withoutZoneIdentifier(): IpHostInterface
415416
*
416417
* @codeCoverageIgnore
417418
*/
419+
#[Deprecated(message:'use League\Uri\Components\Host::new() instead', since:'league/uri-components:7.0.0')]
418420
public static function createFromString(Stringable|string|null $host): self
419421
{
420422
return self::new($host);
@@ -430,6 +432,7 @@ public static function createFromString(Stringable|string|null $host): self
430432
*
431433
* Returns a new instance from null.
432434
*/
435+
#[Deprecated(message:'use League\Uri\Components\Host::new() instead', since:'league/uri-components:7.0.0')]
433436
public static function createFromNull(): self
434437
{
435438
return self::new();
@@ -448,6 +451,7 @@ public static function createFromNull(): self
448451
* Returns a host from an IP address.
449452
*
450453
*/
454+
#[Deprecated(message:'use League\Uri\Components\Host::fromIp() instead', since:'league/uri-components:7.0.0')]
451455
public static function createFromIp(string $ip, string $version = '', ?IPv4Normalizer $normalizer = null): self
452456
{
453457
return self::fromIp($ip, $version);
@@ -463,6 +467,7 @@ public static function createFromIp(string $ip, string $version = '', ?IPv4Norma
463467
*
464468
* Create a new instance from a URI object.
465469
*/
470+
#[Deprecated(message:'use League\Uri\Components\Host::fromUri() instead', since:'league/uri-components:7.0.0')]
466471
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
467472
{
468473
return self::fromUri($uri);
@@ -478,6 +483,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
478483
*
479484
* Create a new instance from an Authority object.
480485
*/
486+
#[Deprecated(message:'use League\Uri\Components\Host::fromAuthority() instead', since:'league/uri-components:7.0.0')]
481487
public static function createFromAuthority(Stringable|string $authority): self
482488
{
483489
return self::fromAuthority($authority);

components/Components/Path.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use League\Uri\Contracts\PathInterface;
1718
use League\Uri\Contracts\UriInterface;
1819
use League\Uri\Encoder;
@@ -169,6 +170,7 @@ public function withoutLeadingSlash(): PathInterface
169170
*
170171
* Returns a new instance from a string or a stringable object.
171172
*/
173+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
172174
public static function createFromString(Stringable|string|int $path): self
173175
{
174176
return self::new((string) $path);
@@ -184,6 +186,7 @@ public static function createFromString(Stringable|string|int $path): self
184186
*
185187
* Create a new instance from a URI object.
186188
*/
189+
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromUri() instead', since:'league/uri-components:7.0.0')]
187190
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
188191
{
189192
return self::fromUri($uri);

components/Components/Port.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace League\Uri\Components;
1515

16+
use Deprecated;
1617
use League\Uri\Contracts\AuthorityInterface;
1718
use League\Uri\Contracts\PortInterface;
1819
use League\Uri\Contracts\UriInterface;
@@ -111,6 +112,7 @@ public function toInt(): ?int
111112
*
112113
* Create a new instance from a URI object.
113114
*/
115+
#[Deprecated(message:'use League\Uri\Components\Port::fromUri() instead', since:'league/uri-components:7.0.0')]
114116
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
115117
{
116118
return self::fromUri($uri);
@@ -126,6 +128,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
126128
*
127129
* Create a new instance from an Authority object.
128130
*/
131+
#[Deprecated(message:'use League\Uri\Components\Port::fromAuthority() instead', since:'league/uri-components:7.0.0')]
129132
public static function createFromAuthority(AuthorityInterface|Stringable|string $authority): self
130133
{
131134
return self::fromAuthority($authority);
@@ -139,6 +142,7 @@ public static function createFromAuthority(AuthorityInterface|Stringable|string
139142
*
140143
* @codeCoverageIgnore
141144
*/
145+
#[Deprecated(message:'use League\Uri\Components\Port::new() instead', since:'league/uri-components:7.0.0')]
142146
public static function fromInt(int $port): self
143147
{
144148
return self::new($port);

0 commit comments

Comments
 (0)