Skip to content

Commit 3e41c00

Browse files
committed
Add PHP 8.4, drop PHP 8.1
1 parent 73ea0a1 commit 3e41c00

12 files changed

Lines changed: 52 additions & 28 deletions

File tree

.github/workflows/php-checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
php-versions: ['8.1', '8.2', '8.3']
9+
php-versions: ['8.2', '8.3', '8.4']
1010
name: PHP ${{ matrix.php-versions }} tests
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414

1515
- name: Setup PHP
1616
uses: shivammathur/setup-php@v2
@@ -20,10 +20,10 @@ jobs:
2020

2121
- name: Get composer cache directory
2222
id: composer-cache
23-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
23+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2424

2525
- name: Cache dependencies
26-
uses: actions/cache@v1
26+
uses: actions/cache@v4
2727
with:
2828
path: ${{ steps.composer-cache.outputs.dir }}
2929
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.php-cs-fixer.cache
12
.phpunit.*
23
composer.lock
34
vendor

.php-cs-fixer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$config = new PhpCsFixer\Config();
4+
5+
return $config
6+
->setRules([
7+
'@PSR12' => true,
8+
'@PHP82Migration' => true,
9+
])
10+
->setFinder(
11+
PhpCsFixer\Finder::create()
12+
->in(__DIR__)
13+
);

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 6.0.0
4+
5+
### PHP support
6+
7+
- Dropped support for PHP `8.1` and lower.
8+
- Added support for PHP `8.4`.
9+
310
## 5.0.0
411

512
### PHP support

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object-oriented interface to a variety of hashing methods.
99

1010
## Requirements
1111

12-
* PHP `8.1`, `8.2` or PHP `8.3` (recommended)
12+
* PHP `8.2`, `8.3` or PHP `8.4` (recommended)
1313

1414
## Installation
1515

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
]
3636
},
3737
"require": {
38-
"php": "8.1.* || 8.2.* || 8.3.*"
38+
"php": "8.2 - 8.4"
3939
},
4040
"require-dev": {
41-
"phpstan/phpstan": "1.10.46",
42-
"phpunit/phpunit": "10.4.2",
43-
"squizlabs/php_codesniffer": "3.7.2"
41+
"phpstan/phpstan": "2.0.3",
42+
"phpunit/phpunit": "11.5.1",
43+
"squizlabs/php_codesniffer": "3.11.2",
44+
"friendsofphp/php-cs-fixer": "^3.65"
4445
}
4546
}

src/AngryBytes/Hash/HMAC.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function hmac(string $sharedSecret, ...$args): string
3939
{
4040
// Get the data concatenated
4141
$data = '';
42+
/** @var string $arg */
4243
foreach ($args as $arg) {
4344
$data .= $arg;
4445
}

src/AngryBytes/Hash/Hasher/MD5.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class MD5 implements HasherInterface
2525
public function hash(string $string, array $options = []): string
2626
{
2727
$salt = $options['salt'] ?? '';
28+
assert(is_string($salt));
2829

2930
return md5($string . '-' . $salt);
3031
}

tests/AngryBytes/Hash/Test/BlowfishTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function testSerialized(): void
3636
$hasher = $this->createHasher();
3737

3838
// Complex data
39-
$data = array(
40-
new \stdClass,
41-
array('foo', 'bar'),
42-
12345
43-
);
39+
$data = [
40+
new \stdClass(),
41+
['foo', 'bar'],
42+
12345,
43+
];
4444
$this->assertEquals(
4545
'$2y$15$aa5c57dda7634fc90a92duDv2OoNSn8R.p3.GSoaEZd6/vdiiq9lG',
4646
$hasher->hash($data)
@@ -80,11 +80,11 @@ public function testObjectVerify(): void
8080
$hasher = $this->createHasher();
8181

8282
// Complex data
83-
$data = array(
84-
new \stdClass,
85-
array('foo', 'bar'),
86-
12345
87-
);
83+
$data = [
84+
new \stdClass(),
85+
['foo', 'bar'],
86+
12345,
87+
];
8888

8989
$this->assertTrue(
9090
$hasher->verify($data, '$2y$15$aa5c57dda7634fc90a92duDv2OoNSn8R.p3.GSoaEZd6/vdiiq9lG')
@@ -188,7 +188,7 @@ public function testSalt(): void
188188
private function createHasher(): Hash
189189
{
190190
return new Hash(
191-
new BlowfishHasher,
191+
new BlowfishHasher(),
192192
'909b96914de6866224f70f52a13e9fa6'
193193
);
194194
}

tests/AngryBytes/Hash/Test/HashLibTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class HashLibTest extends \PHPUnit\Framework\TestCase
1717
public function testValidSalt(): void
1818
{
1919
new Hash(
20-
new \AngryBytes\Hash\Hasher\MD5
20+
new \AngryBytes\Hash\Hasher\MD5()
2121
);
2222

2323
new Hash(
24-
new \AngryBytes\Hash\Hasher\MD5,
24+
new \AngryBytes\Hash\Hasher\MD5(),
2525
str_repeat('a', 20)
2626
);
2727
}
@@ -34,7 +34,7 @@ public function testSaltTooShort(): void
3434
$this->expectException(\InvalidArgumentException::class);
3535

3636
new Hash(
37-
new \AngryBytes\Hash\Hasher\MD5,
37+
new \AngryBytes\Hash\Hasher\MD5(),
3838
str_repeat('a', 19)
3939
);
4040
}
@@ -47,7 +47,7 @@ public function testSaltTooLong(): void
4747
$this->expectException(\InvalidArgumentException::class);
4848

4949
new Hash(
50-
new \AngryBytes\Hash\Hasher\MD5,
50+
new \AngryBytes\Hash\Hasher\MD5(),
5151
str_repeat('a', CRYPT_SALT_LENGTH + 1)
5252
);
5353
}

0 commit comments

Comments
 (0)