diff --git a/psalm-baseline.xml b/psalm-baseline.xml index cbdfc7da..949d2955 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -314,6 +314,9 @@ gettype($port) + + SensitiveParameter + @@ -467,9 +470,6 @@ - - function () { - $ret $ret diff --git a/src/Uri.php b/src/Uri.php index 563cc70c..5c7cdfc8 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -5,6 +5,7 @@ namespace Laminas\Diactoros; use Psr\Http\Message\UriInterface; +use SensitiveParameter; use function array_keys; use function explode; @@ -228,6 +229,9 @@ public function withScheme($scheme): UriInterface return $new; } + // The following rule is buggy for parameters attributes + // phpcs:disable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter + /** * Create and return a new instance containing the provided user credentials. * @@ -236,8 +240,11 @@ public function withScheme($scheme): UriInterface * * {@inheritdoc} */ - public function withUserInfo($user, $password = null): UriInterface - { + public function withUserInfo( + $user, + #[SensitiveParameter] + $password = null + ): UriInterface { if (! is_string($user)) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a string user argument; received %s', @@ -269,6 +276,8 @@ public function withUserInfo($user, $password = null): UriInterface return $new; } + // phpcs:enable SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing.NoSpaceBetweenTypeHintAndParameter + /** * {@inheritdoc} */