Skip to content

Commit

Permalink
Adding PHP8.4 support and Deprecated attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 4, 2024
1 parent 3cb4b43 commit a6cacf1
Show file tree
Hide file tree
Showing 28 changed files with 136 additions and 65 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
php: ['8.1', '8.2', '8.3', '8.4']
stability: [prefer-lowest, prefer-stable]
include:
- php: '8.4'
flags: "--ignore-platform-req=php"
phpunit-flags: '--no-coverage'
stability: prefer-stable
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -50,11 +45,7 @@ jobs:

- name: Run Unit tests with coverage
run: composer phpunit -- ${{ matrix.phpunit-flags }}
if: ${{ matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' }}

- name: Run Unit tests without coverage
run: composer phpunit:min
if: ${{ matrix.php == '8.4'}}
if: ${{ matrix.php == '8.4' || matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' }}

- name: Run static analysis
run: composer phpstan
Expand Down
5 changes: 5 additions & 0 deletions components/Components/Authority.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use League\Uri\Contracts\AuthorityInterface;
use League\Uri\Contracts\HostInterface;
use League\Uri\Contracts\PortInterface;
Expand Down Expand Up @@ -200,6 +201,7 @@ public function withUserInfo(Stringable|string|null $user, #[SensitiveParameter]
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\Authority::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(UriInterface|Psr7UriInterface $uri): self
{
return self::fromUri($uri);
Expand All @@ -215,6 +217,7 @@ public static function createFromUri(UriInterface|Psr7UriInterface $uri): self
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\Authority::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string $authority): self
{
return self::new($authority);
Expand All @@ -230,6 +233,7 @@ public static function createFromString(Stringable|string $authority): self
*
* Returns a new instance from null.
*/
#[Deprecated(message:'use League\Uri\Components\Authority::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromNull(): self
{
return self::new();
Expand All @@ -255,6 +259,7 @@ public static function createFromNull(): self
* port? : ?int
* } $components
*/
#[Deprecated(message:'use League\Uri\Components\Authority::fromComponents() instead', since:'league/uri-components:7.0.0')]
public static function createFromComponents(array $components): self
{
return self::fromComponents($components);
Expand Down
4 changes: 4 additions & 0 deletions components/Components/DataPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use finfo;
use League\Uri\Contracts\DataPathInterface;
use League\Uri\Contracts\PathInterface;
Expand Down Expand Up @@ -380,6 +381,7 @@ public function withParameters(Stringable|string $parameters): DataPathInterface
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\DataPath::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string $path): self
{
return self::new($path);
Expand All @@ -399,6 +401,7 @@ public static function createFromString(Stringable|string $path): self
*
* @throws SyntaxError If the File is not readable
*/
#[Deprecated(message:'use League\Uri\Components\DataPath::fromFilePath() instead', since:'league/uri-components:7.0.0')]
public static function createFromFilePath(string $path, $context = null): self
{
return self::fromFileContents($path, $context);
Expand All @@ -414,6 +417,7 @@ public static function createFromFilePath(string $path, $context = null): self
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\DataPath::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand Down
7 changes: 7 additions & 0 deletions components/Components/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use Iterator;
use League\Uri\Contracts\AuthorityInterface;
use League\Uri\Contracts\DomainHostInterface;
Expand Down Expand Up @@ -304,6 +305,7 @@ public function withoutLabel(int ...$keys): DomainHostInterface
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\Domain::getIterator() instead', since:'league/uri-components:7.0.0')]
public function labels(): array
{
return $this->labels;
Expand All @@ -319,6 +321,7 @@ public function labels(): array
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\Domain::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string $host): self
{
return self::new($host);
Expand All @@ -336,6 +339,7 @@ public static function createFromString(Stringable|string $host): self
*
* @throws TypeError If a label is the null value
*/
#[Deprecated(message:'use League\Uri\Components\Domain::fromLabels() instead', since:'league/uri-components:7.0.0')]
public static function createFromLabels(iterable $labels): self
{
return self::fromLabels(...$labels);
Expand All @@ -351,6 +355,7 @@ public static function createFromLabels(iterable $labels): self
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\Domain::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand All @@ -366,6 +371,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
*
* Create a new instance from an Authority object.
*/
#[Deprecated(message:'use League\Uri\Components\Domain::fromAuthority() instead', since:'league/uri-components:7.0.0')]
public static function createFromAuthority(AuthorityInterface|Stringable|string $authority): self
{
return self::fromAuthority($authority);
Expand All @@ -381,6 +387,7 @@ public static function createFromAuthority(AuthorityInterface|Stringable|string
*
* Returns a new instance from an iterable structure.
*/
#[Deprecated(message:'use League\Uri\Components\Domain::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromHost(HostInterface $host): self
{
return self::new($host);
Expand Down
3 changes: 3 additions & 0 deletions components/Components/Fragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use League\Uri\Contracts\FragmentInterface;
use League\Uri\Contracts\UriInterface;
use League\Uri\Encoder;
Expand Down Expand Up @@ -76,6 +77,7 @@ public function decoded(): ?string
*
* @codeCoverageIgnore
*/
#[Deprecated(message:'use League\Uri\Components\Fragment::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string $fragment): self
{
return self::new($fragment);
Expand All @@ -91,6 +93,7 @@ public static function createFromString(Stringable|string $fragment): self
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\Fragment::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand Down
9 changes: 8 additions & 1 deletion components/Components/HierarchicalPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use Iterator;
use League\Uri\Contracts\PathInterface;
use League\Uri\Contracts\SegmentedPathInterface;
Expand Down Expand Up @@ -447,12 +448,13 @@ private function buildBasename(string $extension, string $ext, ?string $param =
* DEPRECATION WARNING! This method will be removed in the next major point release.
*
* @deprecated Since version 7.0.0
* @see Domain::getIterator()
* @see HierarchicalPath::getIterator()
*
* @codeCoverageIgnore
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::getIterator() instead', since:'league/uri-components:7.0.0')]
public function segments(): array
{
return $this->segments;
Expand All @@ -468,6 +470,7 @@ public function segments(): array
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string $path): self
{
return self::new($path);
Expand All @@ -481,6 +484,7 @@ public static function createFromString(Stringable|string $path): self
*
* @codeCoverageIgnore
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromPath(PathInterface $path): self
{
return self::new($path);
Expand All @@ -498,6 +502,7 @@ public static function createFromPath(PathInterface $path): self
*
* @deprecated Since version 7.0.0
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromRelative() instead', since:'league/uri-components:7.0.0')]
public static function createRelativeFromSegments(iterable $segments): self
{
return self::fromRelative(...$segments);
Expand All @@ -515,6 +520,7 @@ public static function createRelativeFromSegments(iterable $segments): self
*
* @deprecated Since version 7.0.0
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromAbsolute() instead', since:'league/uri-components:7.0.0')]
public static function createAbsoluteFromSegments(iterable $segments): self
{
return self::fromAbsolute(...$segments);
Expand All @@ -530,6 +536,7 @@ public static function createAbsoluteFromSegments(iterable $segments): self
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand Down
6 changes: 6 additions & 0 deletions components/Components/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use League\Uri\Contracts\AuthorityInterface;
use League\Uri\Contracts\IpHostInterface;
use League\Uri\Contracts\UriInterface;
Expand Down Expand Up @@ -415,6 +416,7 @@ public function withoutZoneIdentifier(): IpHostInterface
*
* @codeCoverageIgnore
*/
#[Deprecated(message:'use League\Uri\Components\Host::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string|null $host): self
{
return self::new($host);
Expand All @@ -430,6 +432,7 @@ public static function createFromString(Stringable|string|null $host): self
*
* Returns a new instance from null.
*/
#[Deprecated(message:'use League\Uri\Components\Host::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromNull(): self
{
return self::new();
Expand All @@ -448,6 +451,7 @@ public static function createFromNull(): self
* Returns a host from an IP address.
*
*/
#[Deprecated(message:'use League\Uri\Components\Host::fromIp() instead', since:'league/uri-components:7.0.0')]
public static function createFromIp(string $ip, string $version = '', ?IPv4Normalizer $normalizer = null): self
{
return self::fromIp($ip, $version);
Expand All @@ -463,6 +467,7 @@ public static function createFromIp(string $ip, string $version = '', ?IPv4Norma
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\Host::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand All @@ -478,6 +483,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
*
* Create a new instance from an Authority object.
*/
#[Deprecated(message:'use League\Uri\Components\Host::fromAuthority() instead', since:'league/uri-components:7.0.0')]
public static function createFromAuthority(Stringable|string $authority): self
{
return self::fromAuthority($authority);
Expand Down
3 changes: 3 additions & 0 deletions components/Components/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use League\Uri\Contracts\PathInterface;
use League\Uri\Contracts\UriInterface;
use League\Uri\Encoder;
Expand Down Expand Up @@ -169,6 +170,7 @@ public function withoutLeadingSlash(): PathInterface
*
* Returns a new instance from a string or a stringable object.
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::new() instead', since:'league/uri-components:7.0.0')]
public static function createFromString(Stringable|string|int $path): self
{
return self::new((string) $path);
Expand All @@ -184,6 +186,7 @@ public static function createFromString(Stringable|string|int $path): self
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\HierarchicalPath::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand Down
4 changes: 4 additions & 0 deletions components/Components/Port.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace League\Uri\Components;

use Deprecated;
use League\Uri\Contracts\AuthorityInterface;
use League\Uri\Contracts\PortInterface;
use League\Uri\Contracts\UriInterface;
Expand Down Expand Up @@ -111,6 +112,7 @@ public function toInt(): ?int
*
* Create a new instance from a URI object.
*/
#[Deprecated(message:'use League\Uri\Components\Port::fromUri() instead', since:'league/uri-components:7.0.0')]
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
{
return self::fromUri($uri);
Expand All @@ -126,6 +128,7 @@ public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
*
* Create a new instance from an Authority object.
*/
#[Deprecated(message:'use League\Uri\Components\Port::fromAuthority() instead', since:'league/uri-components:7.0.0')]
public static function createFromAuthority(AuthorityInterface|Stringable|string $authority): self
{
return self::fromAuthority($authority);
Expand All @@ -139,6 +142,7 @@ public static function createFromAuthority(AuthorityInterface|Stringable|string
*
* @codeCoverageIgnore
*/
#[Deprecated(message:'use League\Uri\Components\Port::new() instead', since:'league/uri-components:7.0.0')]
public static function fromInt(int $port): self
{
return self::new($port);
Expand Down
Loading

0 comments on commit a6cacf1

Please sign in to comment.