Skip to content

Commit d4a2729

Browse files
committed
Raise supported PHP version to 8.0 and related updates
1 parent b329539 commit d4a2729

File tree

5 files changed

+21
-28
lines changed

5 files changed

+21
-28
lines changed

.github/workflows/php.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-versions:
14-
- "7.2"
15-
- "7.3"
16-
- "7.4"
1714
- "8.0"
1815
- "8.1"
1916
- "8.2"

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
}
2626
},
2727
"require": {
28-
"php": ">=7.2"
28+
"php": ">=8.0"
2929
},
3030
"require-dev": {
31-
"ockcyp/covers-validator": "^1.3.3",
32-
"phpunit/phpunit": "^8.5.13||^9.5.0",
31+
"ockcyp/covers-validator": "^1.7.0",
32+
"phpunit/phpunit": "^9.6.34",
3333
"php-parallel-lint/php-console-highlighter": "^1.0",
3434
"php-parallel-lint/php-parallel-lint": "^1.4",
35-
"friendsofphp/php-cs-fixer": "^3.4",
35+
"friendsofphp/php-cs-fixer": "^3.94",
3636
"brainmaestro/composer-git-hooks": "^2.8"
3737
},
3838
"scripts": {

phpunit.xml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<phpunit colors="true"
2-
beStrictAboutTestsThatDoNotTestAnything="true"
3-
beStrictAboutOutputDuringTests="true">
4-
<testsuites>
5-
<testsuite name="HOTP PHP Tests">
6-
<directory>./tests</directory>
7-
</testsuite>
8-
</testsuites>
9-
<filter>
10-
<whitelist addUncoveredFilesFromWhitelist="true">
11-
<directory suffix=".php">./src</directory>
12-
</whitelist>
13-
</filter>
1+
<?xml version="1.0"?>
2+
<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">
3+
<coverage includeUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="HOTP PHP Tests">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
</testsuites>
1413
</phpunit>

src/HOTP.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function generateByCounter(string $key, int $counter): HOTPResult
4646
* @param int|false $timestamp a timestamp to calculate for, defaults to time()
4747
* @return HOTPResult a HOTP Result which can be truncated or output
4848
*/
49-
public static function generateByTime(string $key, int $window, $timestamp = false): HOTPResult
49+
public static function generateByTime(string $key, int $window, int|false $timestamp = false): HOTPResult
5050
{
5151
if (!$timestamp && $timestamp !== 0) {
5252
// @codeCoverageIgnoreStart
@@ -70,7 +70,7 @@ public static function generateByTime(string $key, int $window, $timestamp = fal
7070
* @param int|false $timestamp a timestamp to calculate for, defaults to time()
7171
* @return HOTPResult[]
7272
*/
73-
public static function generateByTimeWindow(string $key, int $window, int $min = -1, int $max = 1, $timestamp = false): array
73+
public static function generateByTimeWindow(string $key, int $window, int $min = -1, int $max = 1, int|false $timestamp = false): array
7474
{
7575
if (!$timestamp && $timestamp !== 0) {
7676
// @codeCoverageIgnoreStart

src/HOTPResult.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
*/
1515
class HOTPResult
1616
{
17-
protected $hash;
18-
protected $decimal;
19-
protected $hex;
17+
private ?int $decimal = null;
18+
private ?string $hex = null;
2019

21-
public function __construct(string $value)
20+
public function __construct(private string $hash)
2221
{
23-
// store raw
24-
$this->hash = $value;
2522
}
2623

2724
/**

0 commit comments

Comments
 (0)