Accept `\DateTimeInterface` in Totp
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Jul 2022 07:44:08 +0000 (09:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 26 Jul 2022 07:44:08 +0000 (09:44 +0200)
wcfsetup/install/files/lib/system/user/multifactor/totp/Totp.class.php

index 1e4e7f7312ef84d74397ca14479124573de460e7..b0601684dffefdf5a81a939cb9efb553430c02ca 100644 (file)
@@ -72,7 +72,7 @@ final class Totp
     /**
      * Generates the TOTP code for the given timestamp.
      */
-    public function generateTotpCode(\DateTime $time): string
+    public function generateTotpCode(\DateTimeInterface $time): string
     {
         $counter = \intval($time->getTimestamp() / self::TIME_STEP);
 
@@ -85,7 +85,7 @@ final class Totp
      * If this method returns `true` the $minCounter value will be updated to the counter that
      * was used for verification. You MUST store the updated $minCounter to prevent code re-use.
      */
-    public function validateTotpCode(string $userCode, int &$minCounter, \DateTime $time): bool
+    public function validateTotpCode(string $userCode, int &$minCounter, \DateTimeInterface $time): bool
     {
         $counter = \intval($time->getTimestamp() / self::TIME_STEP);