Skip to content

Commit

Permalink
Merge branch '5.2' into 5.3
Browse files Browse the repository at this point in the history
* 5.2:
  CS fix
  CS fix
  CS fixes
  Bump Symfony version to 5.2.12
  Update VERSION for 5.2.11
  Update CHANGELOG for 5.2.11
  Bump Symfony version to 4.4.27
  Update VERSION for 4.4.26
  Update CONTRIBUTORS for 4.4.26
  Update CHANGELOG for 4.4.26
  • Loading branch information
nicolas-grekas committed Jun 30, 2021
1 parent eacf514 commit 61dd1e9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Exception/InvalidPasswordException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class InvalidPasswordException extends \RuntimeException implements ExceptionInterface
{
public function __construct(string $message = 'Invalid password.', int $code = 0, ?\Throwable $previous = null)
public function __construct(string $message = 'Invalid password.', int $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
4 changes: 2 additions & 2 deletions Hasher/MessageDigestPasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase
$this->iterations = $iterations;
}

public function hash(string $plainPassword, ?string $salt = null): string
public function hash(string $plainPassword, string $salt = null): string
{
if ($this->isPasswordTooLong($plainPassword)) {
throw new InvalidPasswordException();
Expand All @@ -69,7 +69,7 @@ public function hash(string $plainPassword, ?string $salt = null): string
return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest);
}

public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
{
if (\strlen($hashedPassword) !== $this->hashLength || false !== strpos($hashedPassword, '$')) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions Hasher/MigratingPasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public function __construct(PasswordHasherInterface $bestHasher, PasswordHasherI
$this->extraHashers = $extraHashers;
}

public function hash(string $plainPassword, ?string $salt = null): string
public function hash(string $plainPassword, string $salt = null): string
{
return $this->bestHasher->hash($plainPassword, $salt);
}

public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
{
if ($this->bestHasher->verify($hashedPassword, $plainPassword, $salt)) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion Hasher/NativePasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class NativePasswordHasher implements PasswordHasherInterface
/**
* @param string|null $algorithm An algorithm supported by password_hash() or null to use the best available algorithm
*/
public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, ?string $algorithm = null)
public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algorithm = null)
{
$cost = $cost ?? 13;
$opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4);
Expand Down
4 changes: 2 additions & 2 deletions Hasher/Pbkdf2PasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase
$this->iterations = $iterations;
}

public function hash(string $plainPassword, ?string $salt = null): string
public function hash(string $plainPassword, string $salt = null): string
{
if ($this->isPasswordTooLong($plainPassword)) {
throw new InvalidPasswordException();
Expand All @@ -74,7 +74,7 @@ public function hash(string $plainPassword, ?string $salt = null): string
return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest);
}

public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
{
if (\strlen($hashedPassword) !== $this->encodedLength || false !== strpos($hashedPassword, '$')) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions Hasher/PlaintextPasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(bool $ignorePasswordCase = false)
/**
* {@inheritdoc}
*/
public function hash(string $plainPassword, ?string $salt = null): string
public function hash(string $plainPassword, string $salt = null): string
{
if ($this->isPasswordTooLong($plainPassword)) {
throw new InvalidPasswordException();
Expand All @@ -47,7 +47,7 @@ public function hash(string $plainPassword, ?string $salt = null): string
return $this->mergePasswordAndSalt($plainPassword, $salt);
}

public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
{
if ($this->isPasswordTooLong($plainPassword)) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions LegacyPasswordHasherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ interface LegacyPasswordHasherInterface extends PasswordHasherInterface
*
* @throws InvalidPasswordException If the plain password is invalid, e.g. excessively long
*/
public function hash(string $plainPassword, ?string $salt = null): string;
public function hash(string $plainPassword, string $salt = null): string;

/**
* Checks that a plain password and a salt match a password hash.
*/
public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool;
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool;
}

0 comments on commit 61dd1e9

Please sign in to comment.