Skip to content

Commit f06c25d

Browse files
committed
utilizes Random\Randomizer in PHP 8.3
1 parent 74618ab commit f06c25d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Utils/Random.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public static function generate(int $length = 10, string $charlist = '0-9a-z'):
3737
throw new Nette\InvalidArgumentException('Length must be greater than zero.');
3838
} elseif ($chLen < 2) {
3939
throw new Nette\InvalidArgumentException('Character list must contain at least two chars.');
40+
} elseif (PHP_VERSION_ID >= 80300) {
41+
return (new \Random\Randomizer)->getBytesFromString($charlist, $length);
4042
}
4143

4244
$res = '';

0 commit comments

Comments
 (0)