Skip to content

Commit

Permalink
Deprecate usage of PSR-7 in API
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jun 10, 2024
1 parent 913a797 commit 432681a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ All Notable changes to `League\Uri\Components` will be documented in this file
### Fixed

- Adding `SensitiveParameter` attribute in the `UserInfo` and the `Authority` class.
- Remove Usage of PSR-7 `UriInterface` in `UrlSearchParams` class

### Deprecated

- None
- Usage of PSR-7 `UriFactoryInterface` is deprecated in `Modifier` class

### Removed

Expand Down
2 changes: 0 additions & 2 deletions components/Components/URLSearchParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use League\Uri\KeyValuePair\Converter;
use League\Uri\QueryString;
use League\Uri\Uri;
use Psr\Http\Message\UriInterface as Psr7UriInterface;
use Stringable;

use function array_is_list;
Expand Down Expand Up @@ -202,7 +201,6 @@ public static function fromAssociative(object|array $associative): self
public static function fromUri(Stringable|string $uri): self
{
$query = match (true) {
$uri instanceof Psr7UriInterface,
$uri instanceof UriInterface => $uri->getQuery(),
default => Uri::new($uri)->getQuery(),
};
Expand Down
6 changes: 6 additions & 0 deletions components/Modifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ final public function __construct(protected readonly Psr7UriInterface|UriInterfa
{
}

/**
* @param Stringable|string $uri
* @param UriFactoryInterface|null $uriFactory Deprecated, will be removed in the next major release
*
* @return static
*/
public static function from(Stringable|string $uri, ?UriFactoryInterface $uriFactory = null): static
{
return new static(match (true) {
Expand Down
4 changes: 4 additions & 0 deletions uri/BaseUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class BaseUri implements Stringable, JsonSerializable, UriAccess
protected readonly Psr7UriInterface|UriInterface|null $origin;
protected readonly ?string $nullValue;

/**
* @param Psr7UriInterface|UriInterface $uri
* @param UriFactoryInterface|null $uriFactory Deprecated, will be removed in the next major release
*/
final protected function __construct(
protected readonly Psr7UriInterface|UriInterface $uri,
protected readonly ?UriFactoryInterface $uriFactory
Expand Down
2 changes: 1 addition & 1 deletion uri/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All Notable changes to `League\Uri` will be documented in this file

### Deprecated

- None
- Usage of PSR-7 `UriFactoryInterface` is deprecated in `BaseUri` class

### Removed

Expand Down

0 comments on commit 432681a

Please sign in to comment.