Skip to content

Commit e217bf6

Browse files
author
roadiz-ci
committed
chore: bumped
1 parent 0b6ae1d commit e217bf6

7 files changed

Lines changed: 12 additions & 23 deletions

File tree

.github/workflows/run-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Static analysis and code style
1+
name: Unit tests, static analysis and code style
22

33
on:
44
push:
@@ -15,11 +15,11 @@ on:
1515
- ready_for_review
1616

1717
jobs:
18-
static-analysis-tests:
18+
run-tests:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
php-version: ['8.3', '8.4', '8.5']
22+
php-version: ['8.2', '8.3']
2323
steps:
2424
- uses: shivammathur/setup-php@v2
2525
with:

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2025 Ambroise Maupate
3+
Copyright © 2024 Ambroise Maupate
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=8.3",
15+
"php": ">=8.2",
1616
"psr/log": ">=1.1",
1717
"ext-openssl": "*"
1818
},
1919
"require-dev": {
20-
"phpstan/phpstan": "^2.1.36",
20+
"phpstan/phpstan": "^1.5.3",
2121
"phpstan/phpdoc-parser": "<2"
2222
},
2323
"autoload": {
@@ -27,8 +27,8 @@
2727
},
2828
"extra": {
2929
"branch-alias": {
30-
"dev-main": "2.7.x-dev",
31-
"dev-develop": "2.8.x-dev"
30+
"dev-main": "2.5.x-dev",
31+
"dev-develop": "2.6.x-dev"
3232
}
3333
}
3434
}

src/PasswordGenerator.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class PasswordGenerator extends RandomGenerator implements PasswordGeneratorInte
1616
*
1717
* @see https://gist.github.com/tylerhall/521810
1818
*/
19-
#[\Override]
2019
public function generatePassword(int $length = 16): string
2120
{
2221
$sets = [];
@@ -28,23 +27,15 @@ public function generatePassword(int $length = 16): string
2827
$all = '';
2928
$password = '';
3029
foreach ($sets as $set) {
31-
$chars = \mb_str_split($set);
32-
$password .= $chars[random_int(0, count($chars) - 1)];
30+
$password .= $set[array_rand(\mb_str_split($set))];
3331
$all .= $set;
3432
}
3533

3634
$all = \mb_str_split($all);
3735
for ($i = 0; $i < $length - count($sets); ++$i) {
38-
$password .= $all[random_int(0, count($all) - 1)];
36+
$password .= $all[array_rand($all)];
3937
}
4038

41-
// Fisher-Yates shuffle using CSPRNG — str_shuffle() uses Mersenne Twister
42-
$chars = \mb_str_split($password);
43-
for ($i = count($chars) - 1; $i > 0; --$i) {
44-
$j = random_int(0, $i);
45-
[$chars[$i], $chars[$j]] = [$chars[$j], $chars[$i]];
46-
}
47-
48-
return implode('', $chars);
39+
return str_shuffle($password);
4940
}
5041
}

src/RandomGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getRandomNumber(int $nbBytes = 32): string
2020
// try OpenSSL
2121
$bytes = \openssl_random_pseudo_bytes($nbBytes, $strong);
2222

23-
if (true === $strong) {
23+
if (false !== $bytes && true === $strong) {
2424
return $bytes;
2525
}
2626

src/SaltGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class SaltGenerator extends RandomGenerator implements SaltGeneratorInterface
88
{
9-
#[\Override]
109
public function generateSalt(): string
1110
{
1211
return strtr(base64_encode($this->getRandomNumber(24)), '{}', '-_');

src/TokenGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class TokenGenerator extends RandomGenerator implements TokenGeneratorInterface
88
{
9-
#[\Override]
109
public function generateToken(): string
1110
{
1211
return rtrim(strtr(base64_encode($this->getRandomNumber()), '+/', '-_'), '=');

0 commit comments

Comments
 (0)