Skip to content

Commit

Permalink
Fix risky falsy comparision thanks to Psalm (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
bocharsky-bw authored Jan 22, 2024
1 parent 8f14995 commit b79a28c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ResetPasswordHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function generateResetToken(object $user, int $resetRequestLifetime = nul
throw new TooManyPasswordRequestsException($availableAt);
}

$resetRequestLifetime = $resetRequestLifetime ?: $this->resetRequestLifetime;
$resetRequestLifetime = $resetRequestLifetime ?? $this->resetRequestLifetime;

$expiresAt = new \DateTimeImmutable(sprintf('+%d seconds', $resetRequestLifetime));

Expand Down Expand Up @@ -161,7 +161,7 @@ public function getTokenLifetime(): int
*/
public function generateFakeResetToken(int $resetRequestLifetime = null): ResetPasswordToken
{
$resetRequestLifetime = $resetRequestLifetime ?: $this->resetRequestLifetime;
$resetRequestLifetime = $resetRequestLifetime ?? $this->resetRequestLifetime;
$expiresAt = new \DateTimeImmutable(sprintf('+%d seconds', $resetRequestLifetime));

$generatedAt = ($expiresAt->getTimestamp() - $resetRequestLifetime);
Expand Down

0 comments on commit b79a28c

Please sign in to comment.