Skip to content

Commit 955ce52

Browse files
committed
add readonly modifiers wherever possible
1 parent e584f0c commit 955ce52

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/Providers/Rng/HashRNGProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class HashRNGProvider implements IRNGProvider
1010
{
11-
public function __construct(private string $algorithm = 'sha256')
11+
public function __construct(private readonly string $algorithm = 'sha256')
1212
{
1313
$algos = array_values(hash_algos());
1414
if (!in_array($this->algorithm, $algos, true)) {

lib/Providers/Rng/OpenSSLRNGProvider.php

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

77
class OpenSSLRNGProvider implements IRNGProvider
88
{
9-
public function __construct(private bool $requirestrong = true)
9+
public function __construct(private readonly bool $requirestrong = true)
1010
{
1111
}
1212

lib/TwoFactorAuth.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ class TwoFactorAuth
2828
private static array $_base32lookup = array();
2929

3030
public function __construct(
31-
private ?string $issuer = null,
32-
private int $digits = 6,
33-
private int $period = 30,
34-
private Algorithm $algorithm = Algorithm::Sha1,
35-
private ?IQRCodeProvider $qrcodeprovider = null,
36-
private ?IRNGProvider $rngprovider = null,
37-
private ?ITimeProvider $timeprovider = null
31+
private readonly ?string $issuer = null,
32+
private readonly int $digits = 6,
33+
private readonly int $period = 30,
34+
private readonly Algorithm $algorithm = Algorithm::Sha1,
35+
private ?IQRCodeProvider $qrcodeprovider = null,
36+
private ?IRNGProvider $rngprovider = null,
37+
private ?ITimeProvider $timeprovider = null
3838
) {
3939
if ($this->digits <= 0) {
4040
throw new TwoFactorAuthException('Digits must be > 0');

0 commit comments

Comments
 (0)