Skip to content

Commit 2fb4f4e

Browse files
committed
Mark passwords and URIs as #[\SensitiveParameter] (PHP 8.2+)
1 parent 9c3f918 commit 2fb4f4e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Client.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ private function setProtocolVersionFromScheme($scheme)
9797
* @param string $password
9898
* @link http://tools.ietf.org/html/rfc1929
9999
*/
100-
private function setAuth($username, $password)
101-
{
100+
private function setAuth(
101+
$username,
102+
#[\SensitiveParameter]
103+
$password
104+
) {
102105
if (strlen($username) > 255 || strlen($password) > 255) {
103106
throw new InvalidArgumentException('Both username and password MUST NOT exceed a length of 255 bytes each');
104107
}
@@ -117,8 +120,10 @@ private function setAuth($username, $password)
117120
* @param string $uri
118121
* @return PromiseInterface Promise<ConnectionInterface,Exception>
119122
*/
120-
public function connect($uri)
121-
{
123+
public function connect(
124+
#[\SensitiveParameter]
125+
$uri
126+
) {
122127
if (strpos($uri, '://') === false) {
123128
$uri = 'tcp://' . $uri;
124129
}

0 commit comments

Comments
 (0)