fix PHP 8 warnings (#18)
This commit is contained in:
1 parent
53328ec267
commit
f6b5464cf0
8 files changed
+12
-12
No files matched your search
@@ -43,7 +43,7 @@ final class NoPwChangePageWarning
|
||||
if ($this->configuration->hasConfiguration(FrontendUser::class)) {
|
||||
$configuration = $this->configuration->getConfiguration(FrontendUser::class);
|
||||
|
||||
if ($configuration['change_days'] ?? false) {
|
||||
if ($configuration['change_days'] ?? null) {
|
||||
$needsPwChangePage = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ final class PasswordChangeListener
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($userEntity);
|
||||
|
||||
$maxDays = $configuration['change_days'];
|
||||
$maxDays = $configuration['change_days'] ?? null;
|
||||
|
||||
if (!$maxDays) {
|
||||
return null;
|
||||
|
||||
@@ -59,7 +59,7 @@ final class PasswordHistoryListener
|
||||
|
||||
$configuration = $this->configuration->getConfiguration(FrontendUser::class);
|
||||
|
||||
$historyLength = (int) $configuration['password_history'];
|
||||
$historyLength = (int) ($configuration['password_history'] ?? null);
|
||||
|
||||
if (0 === $historyLength) {
|
||||
return;
|
||||
@@ -106,7 +106,7 @@ final class PasswordHistoryListener
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration(BackendUser::class);
|
||||
$historyLength = (int) $configuration['password_history'];
|
||||
$historyLength = (int) ($configuration['password_history'] ?? null);
|
||||
|
||||
if (0 === $historyLength) {
|
||||
return $password;
|
||||
|
||||
@@ -38,7 +38,7 @@ final class HaveIBeenPwned implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$minDataBreaches = $configuration['haveibeenpwned'];
|
||||
$minDataBreaches = $configuration['haveibeenpwned'] ?? null;
|
||||
|
||||
if (!$minDataBreaches) {
|
||||
return true;
|
||||
|
||||
@@ -34,7 +34,7 @@ final class MaximumLength implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$maximumLength = $configuration['max_length'];
|
||||
$maximumLength = $configuration['max_length'] ?? null;
|
||||
|
||||
if (!$maximumLength) {
|
||||
return true;
|
||||
|
||||
@@ -34,7 +34,7 @@ final class MinimumLength implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$minimumLength = $configuration['min_length'];
|
||||
$minimumLength = $configuration['min_length'] ?? null;
|
||||
|
||||
if (!$minimumLength) {
|
||||
return true;
|
||||
|
||||
@@ -44,7 +44,7 @@ final class PasswordHistory implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$historyLength = $configuration['password_history'];
|
||||
$historyLength = $configuration['password_history'] ?? null;
|
||||
|
||||
if (!$historyLength) {
|
||||
return true;
|
||||
|
||||
@@ -35,7 +35,7 @@ final class RequiredCharacters implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
$configuration = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$require = $configuration['require'];
|
||||
$require = $configuration['require'] ?? null;
|
||||
|
||||
if (!$require) {
|
||||
return true;
|
||||
@@ -59,7 +59,7 @@ final class RequiredCharacters implements PasswordValidatorInterface
|
||||
if ($actual < $minimum) {
|
||||
if ('other' === $category) {
|
||||
$errors[] = new PasswordValidatorException(
|
||||
sprintf($this->translate('required.other'), $minimum, $configuration['other_chars'])
|
||||
sprintf($this->translate('required.other'), $minimum, $configuration['other_chars'] ?? null)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ final class RequiredCharacters implements PasswordValidatorInterface
|
||||
}
|
||||
|
||||
if (\count($errors) > 1) {
|
||||
throw new PasswordValidatorException(sprintf($this->translate('required.summary'), $require['uppercase'], $require['lowercase'], $require['numbers'], $require['other'], $configuration['other_chars']));
|
||||
throw new PasswordValidatorException(sprintf($this->translate('required.summary'), $require['uppercase'] ?? null, $require['lowercase'] ?? null, $require['numbers'] ?? null, $require['other'] ?? null, $configuration['other_chars'] ?? null));
|
||||
}
|
||||
|
||||
if (\count($errors) > 0) {
|
||||
@@ -112,7 +112,7 @@ final class RequiredCharacters implements PasswordValidatorInterface
|
||||
private function getRequiredOtherCharactersForRegexp(ValidationContext $context): ?string
|
||||
{
|
||||
$config = $this->configuration->getConfiguration($context->getUserEntity());
|
||||
$chars = $config['other_chars'];
|
||||
$chars = $config['other_chars'] ?? null;
|
||||
|
||||
if (!$chars) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user