Skip to content

Commit

Permalink
Mark passwords and URIs as #[\SensitiveParameter] (PHP 8.2+)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Aug 31, 2022
1 parent 9c3f918 commit 2fb4f4e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -117,8 +120,10 @@ private function setAuth($username, $password)
* @param string $uri
* @return PromiseInterface Promise<ConnectionInterface,Exception>
*/
public function connect($uri)
{
public function connect(
#[\SensitiveParameter]
$uri
) {
if (strpos($uri, '://') === false) {
$uri = 'tcp://' . $uri;
}
Expand Down

0 comments on commit 2fb4f4e

Please sign in to comment.