Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ jobs:
strategy:
matrix:
php-versions:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
}
},
"require": {
"php": ">=7.2"
"php": ">=8.0"
},
"require-dev": {
"ockcyp/covers-validator": "^1.3.3",
"phpunit/phpunit": "^8.5.13||^9.5.0",
"ockcyp/covers-validator": "^1.7.0",
"phpunit/phpunit": "^9.6.34",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.4",
"friendsofphp/php-cs-fixer": "^3.4",
"friendsofphp/php-cs-fixer": "^3.94",
"brainmaestro/composer-git-hooks": "^2.8"
},
"scripts": {
Expand Down
25 changes: 12 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<phpunit colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true">
<testsuites>
<testsuite name="HOTP PHP Tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="HOTP PHP Tests">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
4 changes: 2 additions & 2 deletions src/HOTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function generateByCounter(string $key, int $counter): HOTPResult
* @param int|false $timestamp a timestamp to calculate for, defaults to time()
* @return HOTPResult a HOTP Result which can be truncated or output
*/
public static function generateByTime(string $key, int $window, $timestamp = false): HOTPResult
public static function generateByTime(string $key, int $window, int|false $timestamp = false): HOTPResult
{
if (!$timestamp && $timestamp !== 0) {
// @codeCoverageIgnoreStart
Expand All @@ -70,7 +70,7 @@ public static function generateByTime(string $key, int $window, $timestamp = fal
* @param int|false $timestamp a timestamp to calculate for, defaults to time()
* @return HOTPResult[]
*/
public static function generateByTimeWindow(string $key, int $window, int $min = -1, int $max = 1, $timestamp = false): array
public static function generateByTimeWindow(string $key, int $window, int $min = -1, int $max = 1, int|false $timestamp = false): array
Comment thread
thecodedrift marked this conversation as resolved.
{
if (!$timestamp && $timestamp !== 0) {
// @codeCoverageIgnoreStart
Expand Down
9 changes: 3 additions & 6 deletions src/HOTPResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
*/
class HOTPResult
{
protected $hash;
protected $decimal;
protected $hex;
private ?int $decimal = null;
private ?string $hex = null;

public function __construct(string $value)
public function __construct(private string $hash)
{
// store raw
$this->hash = $value;
}

/**
Expand Down