add readonly modifiers wherever possible

This commit is contained in:
Mark Magyar
2023-05-27 21:33:54 +02:00
parent e584f0c56a
commit 955ce522f0
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ use function in_array;
class HashRNGProvider implements IRNGProvider
{
public function __construct(private string $algorithm = 'sha256')
public function __construct(private readonly string $algorithm = 'sha256')
{
$algos = array_values(hash_algos());
if (!in_array($this->algorithm, $algos, true)) {
+1 -1
View File
@@ -6,7 +6,7 @@ namespace RobThree\Auth\Providers\Rng;
class OpenSSLRNGProvider implements IRNGProvider
{
public function __construct(private bool $requirestrong = true)
public function __construct(private readonly bool $requirestrong = true)
{
}
+7 -7
View File
@@ -28,13 +28,13 @@ class TwoFactorAuth
private static array $_base32lookup = array();
public function __construct(
private ?string $issuer = null,
private int $digits = 6,
private int $period = 30,
private Algorithm $algorithm = Algorithm::Sha1,
private ?IQRCodeProvider $qrcodeprovider = null,
private ?IRNGProvider $rngprovider = null,
private ?ITimeProvider $timeprovider = null
private readonly ?string $issuer = null,
private readonly int $digits = 6,
private readonly int $period = 30,
private readonly Algorithm $algorithm = Algorithm::Sha1,
private ?IQRCodeProvider $qrcodeprovider = null,
private ?IRNGProvider $rngprovider = null,
private ?ITimeProvider $timeprovider = null
) {
if ($this->digits <= 0) {
throw new TwoFactorAuthException('Digits must be > 0');