From 2fb4f4e20f8d07e5717ece90eb77a69548a48a45 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Wed, 31 Aug 2022 15:02:29 +0200 Subject: [PATCH] Mark passwords and URIs as `#[\SensitiveParameter]` (PHP 8.2+) --- src/Client.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 83970e6..e564947 100644 --- a/src/Client.php +++ b/src/Client.php @@ -97,8 +97,11 @@ private function setProtocolVersionFromScheme($scheme) * @param string $password * @link http://tools.ietf.org/html/rfc1929 */ - private function setAuth($username, $password) - { + private function setAuth( + $username, + #[\SensitiveParameter] + $password + ) { if (strlen($username) > 255 || strlen($password) > 255) { throw new InvalidArgumentException('Both username and password MUST NOT exceed a length of 255 bytes each'); } @@ -117,8 +120,10 @@ private function setAuth($username, $password) * @param string $uri * @return PromiseInterface Promise */ - public function connect($uri) - { + public function connect( + #[\SensitiveParameter] + $uri + ) { if (strpos($uri, '://') === false) { $uri = 'tcp://' . $uri; }