From e5b4eed81ac878c036393f4b0ef7a2ca1e9ce2cf Mon Sep 17 00:00:00 2001
From: Spomky <contact@spomky-labs.com>
Date: Wed, 2 Feb 2022 21:22:04 +0100
Subject: [PATCH] Bugs fixed

---
 doc/UPGRADE_v10-v11.md |  2 ++
 doc/index.md           | 14 +++-----------
 src/HOTP.php           |  6 +++---
 src/OTPInterface.php   |  2 +-
 src/TOTP.php           |  4 ++--
 5 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/doc/UPGRADE_v10-v11.md b/doc/UPGRADE_v10-v11.md
index 08b1027..df08eda 100644
--- a/doc/UPGRADE_v10-v11.md
+++ b/doc/UPGRADE_v10-v11.md
@@ -1 +1,3 @@
 # Upgrade from `v10.x` to `v11.x`
+
+Congratulation, you have nothing to do!
\ No newline at end of file
diff --git a/doc/index.md b/doc/index.md
index eb10280..1b00011 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -18,10 +18,8 @@ Support for the version 9 will end when PHP 7.1 will not be maintained (1 Dec 20
 
 # Prerequisites
 
-This library needs at least `PHP 7.1` for v9.0 and `PHP 7.2` for v10.0.
-It has been successfully tested using `PHP 7.1`, `PHP 7.2`, `PHP 7.3`.
-
-Nightly branch (`PHP 8.0`) fails as dependencies are not yet compatible.
+This library needs at least `PHP 8.0`.
+It has been successfully tested using `PHP 8.0` and `PHP 8.1`.
 
 # Installation
 
@@ -31,13 +29,6 @@ The preferred way to install this library is to rely on Composer:
 composer require spomky-labs/otphp
 ```
 
-By default, documentation and test environment are excluded.
-If you want to test the library or get the documentation, please add `--prefer-source` option:
-
-```sh
-composer require spomky-labs/otphp --prefer-source
-```
-
 # TOTP or HOTP?
 
 This library supports both `TOTP` and `HOTP`.
@@ -107,3 +98,4 @@ $otp->verify($input); // Returns true if the input is verified, otherwise false.
 
 * [From `v8.3` to `v9.x`](UPGRADE_v8-v9.md)
 * [From `v9.x` to `v10.x`](UPGRADE_v9-v10.md)
+* [From `v10.x` to `v11.x`](UPGRADE_v10-v11.md)
diff --git a/src/HOTP.php b/src/HOTP.php
index 7c94187..573ae46 100644
--- a/src/HOTP.php
+++ b/src/HOTP.php
@@ -41,7 +41,7 @@ final class HOTP extends OTP implements HOTPInterface
     /**
      * If the counter is not provided, the OTP is verified at the actual counter.
      */
-    public function verify(string $otp, null|int $counter = null, null|int|float $window = null): bool
+    public function verify(string $otp, null|int $counter = null, null|int $window = null): bool
     {
         Assertion::greaterOrEqualThan($counter, 0, 'The counter must be at least 0.');
 
@@ -81,12 +81,12 @@ final class HOTP extends OTP implements HOTPInterface
         $this->setCounter($counter);
     }
 
-    private function getWindow(null|int|float $window): int|float
+    private function getWindow(null|int $window): int
     {
         return abs($window ?? 0);
     }
 
-    private function verifyOtpWithWindow(string $otp, int $counter, null|int|float $window): bool
+    private function verifyOtpWithWindow(string $otp, int $counter, null|int $window): bool
     {
         $window = $this->getWindow($window);
 
diff --git a/src/OTPInterface.php b/src/OTPInterface.php
index 0d8d888..38f1db4 100644
--- a/src/OTPInterface.php
+++ b/src/OTPInterface.php
@@ -15,7 +15,7 @@ interface OTPInterface
      * Verify that the OTP is valid with the specified input. If no input is provided, the input is set to a default
      * value or false is returned.
      */
-    public function verify(string $otp, null|int $input = null, null|int|float $window = null): bool;
+    public function verify(string $otp, null|int $input = null, null|int $window = null): bool;
 
     /**
      * @return string The secret of the OTP
diff --git a/src/TOTP.php b/src/TOTP.php
index 2adf41f..bba3f43 100644
--- a/src/TOTP.php
+++ b/src/TOTP.php
@@ -55,7 +55,7 @@ final class TOTP extends OTP implements TOTPInterface
     /**
      * If no timestamp is provided, the OTP is verified at the actual timestamp.
      */
-    public function verify(string $otp, null|int $timestamp = null, null|int|float $window = null): bool
+    public function verify(string $otp, null|int $timestamp = null, null|int $window = null): bool
     {
         $timestamp = $this->getTimestamp($timestamp);
 
@@ -126,7 +126,7 @@ final class TOTP extends OTP implements TOTPInterface
         $this->setParameter('epoch', $epoch);
     }
 
-    private function verifyOtpWithWindow(string $otp, int $timestamp, int|float $window): bool
+    private function verifyOtpWithWindow(string $otp, int $timestamp, int $window): bool
     {
         $window = abs($window);
 
-- 
GitLab