fix code quality, typage, php-csfixer
Some checks failed
Cadoles/hydra-sql/pipeline/pr-develop There was a failure building this commit
Cadoles/hydra-sql/pipeline/head This commit is unstable

This commit is contained in:
2024-09-24 11:47:52 +02:00
parent 27f957124b
commit f36a675d22
11 changed files with 40 additions and 37 deletions

View File

@ -30,7 +30,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
/**
* Pas utilisé, mais on doit le garder pour le implements
*/
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();
@ -39,7 +39,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
return hash($plainPassword.$salt, $this->hashAlgoLegacy[0]);
}
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
{
if ('' === $plainPassword || $this->isPasswordTooLong($plainPassword)) {
return false;
@ -76,10 +76,8 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
/**
* Retourne la string à hasher en fonction du pattern indiqué
*
* @return string
*/
protected function getPasswordToHash($plainTextPassword, $salt)
protected function getPasswordToHash(string $plainTextPassword, ?string $salt = null): string
{
$arrayRef = [
self::PASSWORD_PATTERN => $plainTextPassword,
@ -101,7 +99,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
return $completedPlainPassword;
}
protected function compareSsha($hashPassword, $plainPassword)
protected function compareSsha(string $hashPassword, string $plainPassword): bool
{
$base_64_hash_with_salt = substr($hashPassword, 6);
$hash_with_salt = base64_decode($base_64_hash_with_salt);