Skip to content
Code-Schnipsel Gruppen Projekte
Commit 3e22ce9e erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

fix: phpstan errors

Übergeordneter f3b92a70
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!16Next 3.x,!13Update 'next-4.x' with latest changes from 'main'
Pipeline-Nr. 13959 mit Warnungen bestanden
......@@ -20,6 +20,11 @@ parameters:
count: 1
path: src/QUI/Verification/VerificationFactory.php
-
message: "#^Cannot access property \\$createDate on QUI\\\\Verification\\\\Entity\\\\AbstractVerification\\|null\\.$#"
count: 1
path: src/QUI/Verification/VerificationFactory.php
-
message: "#^Cannot call method createRandomDigitsCode\\(\\) on QUI\\\\Verification\\\\Interface\\\\VerificationCodeFactoryInterface\\|null\\.$#"
count: 2
......@@ -37,7 +42,7 @@ parameters:
-
message: "#^Cannot call method findByIdentifier\\(\\) on QUI\\\\Verification\\\\Interface\\\\VerificationRepositoryInterface\\|null\\.$#"
count: 3
count: 4
path: src/QUI/Verification/VerificationFactory.php
-
......
......@@ -10,11 +10,17 @@
*/
class VerificationCooldownActiveException extends Exception
{
/**
* @param DateTimeImmutable $cooldownExpirationDate
* @param string|null $message
* @param int $code
* @param array<string,mixed> $context
*/
public function __construct(
public readonly DateTimeImmutable $cooldownExpirationDate,
$message = null,
?string $message = null,
int $code = 0,
$context = []
array $context = []
) {
parent::__construct($message, $code, $context);
}
......
......@@ -149,7 +149,7 @@ public function createPhoneNumberVerification(
]);
}
$this->checkCooldown($identifier, Settings::get('cooldownPhoneVerification'));
$this->checkCooldown($identifier, (int)Settings::get('cooldownPhoneVerification'));
$this->verificationRepository->delete($existingVerification);
}
......@@ -216,7 +216,7 @@ public function createAddressVerification(
]);
}
$this->checkCooldown($identifier, Settings::get('cooldownAddressVerification'));
$this->checkCooldown($identifier, (int)Settings::get('cooldownAddressVerification'));
$this->verificationRepository->delete($existingVerification);
}
......@@ -295,7 +295,16 @@ private function checkCooldown(string $identifier, int $cooldownMinutes): void
$existingVerification = $this->verificationRepository->findByIdentifier($identifier);
$now = date_create();
$cooldownExpirationDate = clone $existingVerification->createDate;
$cooldownExpirationDate->add(date_interval_create_from_date_string($cooldownMinutes . ' minutes'));
$cooldownMinutesInterval = date_interval_create_from_date_string($cooldownMinutes . ' minutes');
if ($cooldownMinutesInterval === false) {
QUI\System\Log::addWarning(
"Cannot calculate verification cooldown minutes from value $cooldownMinutes."
);
return;
}
$cooldownExpirationDate = $cooldownExpirationDate->add($cooldownMinutesInterval);
if ($now >= $cooldownExpirationDate) {
return;
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren