Skip to content

Commit 0d30427

Browse files
committed
Readonly properties
1 parent 59d643a commit 0d30427

File tree

67 files changed

+160
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+160
-160
lines changed

src/Alg/Encryption/AbstractEncryptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ abstract class AbstractEncryptor implements EncryptionAlgorithmInterface
3636
*/
3737
public function __construct(
3838
#[\SensitiveParameter]
39-
private KeyInterface $key,
40-
protected string $algId,
39+
private readonly KeyInterface $key,
40+
protected readonly string $algId,
4141
) {
4242
Assert::oneOf(
4343
$algId,

src/Alg/Encryption/EncryptionAlgorithmFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class EncryptionAlgorithmFactory
6262
* @param string[] $blacklist A list of algorithms forbidden for their use.
6363
*/
6464
public function __construct(
65-
protected array $blacklist = self::DEFAULT_BLACKLIST,
65+
protected readonly array $blacklist = self::DEFAULT_BLACKLIST,
6666
) {
6767
// initialize the cache for supported algorithms per known implementation
6868
if (!self::$initialized) {

src/Alg/KeyTransport/AbstractKeyTransporter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ abstract class AbstractKeyTransporter implements KeyTransportAlgorithmInterface
3636
*/
3737
public function __construct(
3838
#[\SensitiveParameter]
39-
private KeyInterface $key,
40-
protected string $algId,
39+
private readonly KeyInterface $key,
40+
protected readonly string $algId,
4141
) {
4242
Assert::oneOf(
4343
$algId,

src/Alg/KeyTransport/KeyTransportAlgorithmFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class KeyTransportAlgorithmFactory
6060
* @param string[] $blacklist A list of algorithms forbidden for their use.
6161
*/
6262
public function __construct(
63-
protected array $blacklist = self::DEFAULT_BLACKLIST,
63+
protected readonly array $blacklist = self::DEFAULT_BLACKLIST,
6464
) {
6565
// initialize the cache for supported algorithms per known implementation
6666
if (!self::$initialized) {

src/Alg/Signature/AbstractSigner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ abstract class AbstractSigner implements SignatureAlgorithmInterface
3737
*/
3838
public function __construct(
3939
#[\SensitiveParameter]
40-
private KeyInterface $key,
41-
protected string $algId,
42-
protected string $digest,
40+
private readonly KeyInterface $key,
41+
protected readonly string $algId,
42+
protected readonly string $digest,
4343
) {
4444
Assert::oneOf(
4545
$algId,

src/Alg/Signature/SignatureAlgorithmFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class SignatureAlgorithmFactory
6464
* @param string[] $blacklist A list of algorithms forbidden for their use.
6565
*/
6666
public function __construct(
67-
protected array $blacklist = self::DEFAULT_BLACKLIST,
67+
protected readonly array $blacklist = self::DEFAULT_BLACKLIST,
6868
) {
6969
// initialize the cache for supported algorithms per known implementation
7070
if (!self::$initialized) {

src/CryptoEncoding/PEM.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class PEM
5959
* @param string $data Payload
6060
*/
6161
public function __construct(
62-
protected string $type,
63-
protected string $data,
62+
protected readonly string $type,
63+
protected readonly string $data,
6464
) {
6565
}
6666

src/Key/AsymmetricKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class AsymmetricKey implements KeyInterface
2121
* @param \SimpleSAML\XMLSecurity\CryptoEncoding\PEM $material The associated key material.
2222
*/
2323
public function __construct(
24-
protected PEM $material,
24+
protected readonly PEM $material,
2525
) {
2626
}
2727

src/Key/SymmetricKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SymmetricKey implements KeyInterface
2828
* @param string $material The associated key material.
2929
*/
3030
public function __construct(
31-
protected string $material,
31+
protected readonly string $material,
3232
) {
3333
}
3434

src/Key/X509Certificate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class X509Certificate
2424
{
2525
/** @var \SimpleSAML\XMLSecurity\Key\PublicKey */
26-
protected PublicKey $publicKey;
26+
protected readonly PublicKey $publicKey;
2727

2828
/** @var array<string, string> */
2929
protected array $thumbprint = [];
@@ -41,7 +41,7 @@ class X509Certificate
4141
* @throws \SimpleSAML\XMLSecurity\Exception\OpenSSLException If the certificate cannot be exported to PEM format.
4242
*/
4343
final public function __construct(
44-
protected PEM $material,
44+
protected readonly PEM $material,
4545
) {
4646
Assert::oneOf($material->type(), [PEM::TYPE_CERTIFICATE], "PEM structure has the wrong type %s.");
4747

0 commit comments

Comments
 (0)