Skip to content

Commit b0f4ec5

Browse files
committed
Revert SensitiveParameter improved usage
1 parent 2efefeb commit b0f4ec5

File tree

17 files changed

+85
-76
lines changed

17 files changed

+85
-76
lines changed

components/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ All Notable changes to `League\Uri\Components` will be documented in this file
1717

1818
### Fixed
1919

20-
- Adding `SensitiveParameter` attribute in the `UserInfo` and the `Authority` class.
2120
- Remove Usage of PSR-7 `UriInterface` in `UrlSearchParams` class
2221
- Normalizes `fromUri` to return the same value for the component if the URI object has the same string representation.
2322

components/Components/Authority.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747
/**
4848
* @throws SyntaxError If the component contains invalid HostInterface part.
4949
*/
50-
public static function new(#[SensitiveParameter] Stringable|string|null $value = null): self
50+
public static function new(Stringable|string|null $value = null): self
5151
{
5252
$components = UriString::parseAuthority(self::filterComponent($value));
5353

@@ -64,7 +64,7 @@ public static function new(#[SensitiveParameter] Stringable|string|null $value =
6464
/**
6565
* Create a new instance from a URI object.
6666
*/
67-
public static function fromUri(#[SensitiveParameter] Stringable|string $uri): self
67+
public static function fromUri(Stringable|string $uri): self
6868
{
6969
$uri = self::filterUri($uri);
7070

@@ -87,7 +87,7 @@ public static function fromUri(#[SensitiveParameter] Stringable|string $uri): se
8787
* port? : ?int
8888
* } $components
8989
*/
90-
public static function fromComponents(#[SensitiveParameter] array $components): self
90+
public static function fromComponents(array $components): self
9191
{
9292
$components += ['user' => null, 'pass' => null, 'host' => null, 'port' => null];
9393

@@ -104,7 +104,7 @@ public function value(): ?string
104104
}
105105

106106
private static function getAuthorityValue(
107-
#[SensitiveParameter] UserInfoInterface $userInfo,
107+
UserInfoInterface $userInfo,
108108
HostInterface $host,
109109
PortInterface $port
110110
): ?string {
@@ -200,7 +200,7 @@ public function withUserInfo(Stringable|string|null $user, #[SensitiveParameter]
200200
*
201201
* Create a new instance from a URI object.
202202
*/
203-
public static function createFromUri(#[SensitiveParameter] UriInterface|Psr7UriInterface $uri): self
203+
public static function createFromUri(UriInterface|Psr7UriInterface $uri): self
204204
{
205205
return self::fromUri($uri);
206206
}
@@ -215,7 +215,7 @@ public static function createFromUri(#[SensitiveParameter] UriInterface|Psr7UriI
215215
*
216216
* Returns a new instance from a string or a stringable object.
217217
*/
218-
public static function createFromString(#[SensitiveParameter] Stringable|string $authority): self
218+
public static function createFromString(Stringable|string $authority): self
219219
{
220220
return self::new($authority);
221221
}
@@ -255,7 +255,7 @@ public static function createFromNull(): self
255255
* port? : ?int
256256
* } $components
257257
*/
258-
public static function createFromComponents(#[SensitiveParameter] array $components): self
258+
public static function createFromComponents(array $components): self
259259
{
260260
return self::fromComponents($components);
261261
}

components/Components/Host.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use League\Uri\Idna\Converter as IdnConverter;
2323
use League\Uri\IPv4\Converter as IPv4Converter;
2424
use League\Uri\IPv4Normalizer;
25-
use League\Uri\IPv6\Converter;
2625
use League\Uri\Uri;
2726
use Psr\Http\Message\UriInterface as Psr7UriInterface;
2827
use Stringable;

components/Components/SchemeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace League\Uri\Components;
1313

14+
use Generator;
1415
use League\Uri\Contracts\UriInterface;
1516
use League\Uri\Exceptions\SyntaxError;
1617
use League\Uri\Http;
@@ -125,7 +126,7 @@ public function it_can_detect_information_about_special_schemes(
125126
self::assertSame($defaultPort, $schemeObject->defaultPort());
126127
}
127128

128-
public static function getSchemeInfoProvider(): \Generator
129+
public static function getSchemeInfoProvider(): Generator
129130
{
130131
yield 'detect an HTTP URL' => [
131132
'scheme' => 'http',

components/Components/UserInfo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
/**
5252
* Create a new instance from a URI object.
5353
*/
54-
public static function fromUri(#[SensitiveParameter] Stringable|string $uri): self
54+
public static function fromUri(Stringable|string $uri): self
5555
{
5656
$uri = self::filterUri($uri);
5757

@@ -64,7 +64,7 @@ public static function fromUri(#[SensitiveParameter] Stringable|string $uri): se
6464
/**
6565
* Create a new instance from an Authority object.
6666
*/
67-
public static function fromAuthority(#[SensitiveParameter] Stringable|string|null $authority): self
67+
public static function fromAuthority(Stringable|string|null $authority): self
6868
{
6969
return match (true) {
7070
$authority instanceof AuthorityInterface => self::new($authority->getUserInfo()),
@@ -80,7 +80,7 @@ public static function fromAuthority(#[SensitiveParameter] Stringable|string|nul
8080
*
8181
* @param array{user? : ?string, pass? : ?string} $components
8282
*/
83-
public static function fromComponents(#[SensitiveParameter] array $components): self
83+
public static function fromComponents(array $components): self
8484
{
8585
$components += ['user' => null, 'pass' => null];
8686

@@ -93,7 +93,7 @@ public static function fromComponents(#[SensitiveParameter] array $components):
9393
/**
9494
* Creates a new instance from an encoded string.
9595
*/
96-
public static function new(#[SensitiveParameter] Stringable|string|null $value = null): self
96+
public static function new(Stringable|string|null $value = null): self
9797
{
9898
if ($value instanceof UriComponentInterface) {
9999
$value = $value->value();
@@ -185,7 +185,7 @@ public function withPass(#[SensitiveParameter] Stringable|string|null $password)
185185
*
186186
* Create a new instance from a URI object.
187187
*/
188-
public static function createFromUri(#[SensitiveParameter] Psr7UriInterface|UriInterface $uri): self
188+
public static function createFromUri(Psr7UriInterface|UriInterface $uri): self
189189
{
190190
return self::fromUri($uri);
191191
}
@@ -200,7 +200,7 @@ public static function createFromUri(#[SensitiveParameter] Psr7UriInterface|UriI
200200
*
201201
* Create a new instance from an Authority object.
202202
*/
203-
public static function createFromAuthority(#[SensitiveParameter] AuthorityInterface|Stringable|string $authority): self
203+
public static function createFromAuthority(AuthorityInterface|Stringable|string $authority): self
204204
{
205205
return self::fromAuthority($authority);
206206
}
@@ -215,7 +215,7 @@ public static function createFromAuthority(#[SensitiveParameter] AuthorityInterf
215215
*
216216
* Creates a new instance from an encoded string.
217217
*/
218-
public static function createFromString(#[SensitiveParameter] Stringable|string $userInfo): self
218+
public static function createFromString(Stringable|string $userInfo): self
219219
{
220220
return self::new($userInfo);
221221
}

components/Modifier.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ final public function __construct(protected readonly Psr7UriInterface|UriInterfa
4545
}
4646

4747
/**
48-
* @param Stringable|string $uri
4948
* @param UriFactoryInterface|null $uriFactory Deprecated, will be removed in the next major release
5049
*
51-
* @return static
5250
*/
5351
public static function from(Stringable|string $uri, ?UriFactoryInterface $uriFactory = null): static
5452
{

components/ModifierTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -845,18 +845,18 @@ public static function idnUriProvider(): iterable
845845
];
846846

847847
yield 'idn host are changed' => [
848-
'expected' => "http://bébé.be",
849-
'input' => "http://xn--bb-bjab.be",
848+
'expected' => 'http://bébé.be',
849+
'input' => 'http://xn--bb-bjab.be',
850850
];
851851

852852
yield 'idn host are the same' => [
853-
'expected' => "http://bébé.be",
854-
'input' => "http://bébé.be",
853+
'expected' => 'http://bébé.be',
854+
'input' => 'http://bébé.be',
855855
];
856856

857857
yield 'the rest of the URI is not affected and uses RFC3986 rules' => [
858-
'expected' => "http://bébé.be?q=toto%20le%20h%C3%A9ros",
859-
'input' => "http://bébé.be:80?q=toto le héros",
858+
'expected' => 'http://bébé.be?q=toto%20le%20h%C3%A9ros',
859+
'input' => 'http://bébé.be:80?q=toto le héros',
860860
];
861861
}
862862

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@
2828
"ext-fileinfo": "*",
2929
"ext-gmp": "*",
3030
"ext-intl": "*",
31-
"friendsofphp/php-cs-fixer": "^3.59.3",
32-
"guzzlehttp/psr7": "^2.6.2",
33-
"laminas/laminas-diactoros": "^3.3.1",
34-
"nyholm/psr7": "^1.8.1",
31+
"friendsofphp/php-cs-fixer": "^3.64.0",
32+
"guzzlehttp/psr7": "^2.7.0",
33+
"laminas/laminas-diactoros": "^3.4.0",
34+
"nyholm/psr7": "^1.8.2",
3535
"phpbench/phpbench": "^1.3.1",
36-
"phpstan/phpstan": "^1.11.7",
37-
"phpstan/phpstan-deprecation-rules": "^1.2.0",
36+
"phpstan/phpstan": "^1.12.4",
37+
"phpstan/phpstan-deprecation-rules": "^1.2.1",
3838
"phpstan/phpstan-phpunit": "^1.4.0",
3939
"phpstan/phpstan-strict-rules": "^1.6.0",
40-
"phpunit/phpunit": "^10.5.17 || ^11.2.6",
40+
"phpunit/phpunit": "^10.5.17 || ^11.3.6",
4141
"psr/http-factory": "^1.1.0",
4242
"psr/http-message": "^1.1.0 || ^2.0",
43-
"symfony/var-dumper": "^6.4.9",
43+
"symfony/var-dumper": "^6.4.11",
4444
"uri-templates/uritemplate-test": "dev-master"
4545
},
4646
"repositories": [

interfaces/IPv4/Converter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use function preg_match;
2626
use function str_ends_with;
2727
use function substr;
28+
2829
use const FILTER_FLAG_IPV4;
2930
use const FILTER_FLAG_IPV6;
3031
use const FILTER_VALIDATE_IP;
@@ -142,7 +143,7 @@ public function to6to4(Stringable|string|null $host): ?string
142143
explode('.', $host)
143144
);
144145

145-
return '['.self::IPV6_6TO4_PREFIX . $parts[0] . $parts[1] . ':' . $parts[2] . $parts[3] . '::]';
146+
return '['.self::IPV6_6TO4_PREFIX.$parts[0].$parts[1].':'.$parts[2].$parts[3].'::]';
146147
}
147148

148149
public function toIPv4MappedIPv6(Stringable|string|null $host): ?string

interfaces/IPv4/ConverterTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public function testConvertToDecimal(
3434
string $hexadecimal,
3535
string $sixToFour,
3636
string $ipv4Mapped,
37-
): void
38-
{
37+
): void {
3938
self::assertSame($octal, Converter::fromGMP()->toOctal($input));
4039
self::assertSame($octal, Converter::fromNative()->toOctal($input));
4140
self::assertSame($octal, Converter::fromBCMath()->toOctal($input));

0 commit comments

Comments
 (0)