Skip to content

Commit cd6be3e

Browse files
committed
Remove unnecessary explicit type definition in constant declarations
In adhering to recommended coding practices and improving code readability, the explicit type definition in constant declarations has been removed across various files. This revision was geared towards enhancing simplicity and maintainability, without sacrificing the core functionality of the defined constants.
1 parent da529a3 commit cd6be3e

24 files changed

+46
-46
lines changed

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
return static function (RectorConfig $config): void {
1515
$config->import(SetList::DEAD_CODE);
16-
$config->import(LevelSetList::UP_TO_PHP_83);
16+
$config->import(LevelSetList::UP_TO_PHP_82);
1717
$config->import(SymfonySetList::SYMFONY_64);
1818
$config->import(SymfonySetList::SYMFONY_50_TYPES);
1919
$config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
@@ -38,7 +38,7 @@
3838
__DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSource.php',
3939
__DIR__ . '/src/Bundle/JoseFramework/DependencyInjection/Source/KeyManagement/JWKSetSource.php',
4040
]);
41-
$config->phpVersion(PhpVersion::PHP_83);
41+
$config->phpVersion(PhpVersion::PHP_82);
4242
$config->parallel();
4343
$config->importNames();
4444
$config->importShortClasses();

src/Bundle/Helper/ConfigurationHelper.php

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

1010
final readonly class ConfigurationHelper
1111
{
12-
final public const string BUNDLE_ALIAS = 'jose';
12+
final public const BUNDLE_ALIAS = 'jose';
1313

1414
/**
1515
* @param string[] $signatureAlgorithms

src/Experimental/Signature/Blake2b.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
final readonly class Blake2b implements MacAlgorithm
2222
{
23-
private const int MINIMUM_KEY_LENGTH = 32;
23+
private const MINIMUM_KEY_LENGTH = 32;
2424

2525
public function __construct()
2626
{

src/Library/Checker/AlgorithmChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
final readonly class AlgorithmChecker implements HeaderChecker
1717
{
18-
private const string HEADER_NAME = 'alg';
18+
private const HEADER_NAME = 'alg';
1919

2020
/**
2121
* @param string[] $supportedAlgorithms

src/Library/Checker/AudienceChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
final readonly class AudienceChecker implements ClaimChecker, HeaderChecker
1616
{
17-
private const string CLAIM_NAME = 'aud';
17+
private const CLAIM_NAME = 'aud';
1818

1919
public function __construct(
2020
private string $audience,

src/Library/Checker/ExpirationTimeChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
final readonly class ExpirationTimeChecker implements ClaimChecker, HeaderChecker
1818
{
19-
private const string NAME = 'exp';
19+
private const NAME = 'exp';
2020

2121
public function __construct(
2222
private ClockInterface $clock,

src/Library/Checker/IssuedAtChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
final readonly class IssuedAtChecker implements ClaimChecker, HeaderChecker
1616
{
17-
private const string NAME = 'iat';
17+
private const NAME = 'iat';
1818

1919
public function __construct(
2020
private ClockInterface $clock,

src/Library/Checker/IssuerChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
final readonly class IssuerChecker implements ClaimChecker, HeaderChecker
1717
{
18-
private const string CLAIM_NAME = 'iss';
18+
private const CLAIM_NAME = 'iss';
1919

2020
public function __construct(
2121
private array $issuers,

src/Library/Checker/NotBeforeChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
final readonly class NotBeforeChecker implements ClaimChecker, HeaderChecker
1616
{
17-
private const string NAME = 'nbf';
17+
private const NAME = 'nbf';
1818

1919
public function __construct(
2020
private ClockInterface $clock,

src/Library/Checker/UnencodedPayloadChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
final class UnencodedPayloadChecker implements HeaderChecker
1616
{
17-
private const string HEADER_NAME = 'b64';
17+
private const HEADER_NAME = 'b64';
1818

1919
#[Override]
2020
public function checkHeader(mixed $value): void

src/Library/Core/Util/ECSignature.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
*/
1515
final readonly class ECSignature
1616
{
17-
private const string ASN1_SEQUENCE = '30';
17+
private const ASN1_SEQUENCE = '30';
1818

19-
private const string ASN1_INTEGER = '02';
19+
private const ASN1_INTEGER = '02';
2020

21-
private const int ASN1_MAX_SINGLE_BYTE = 128;
21+
private const ASN1_MAX_SINGLE_BYTE = 128;
2222

23-
private const string ASN1_LENGTH_2BYTES = '81';
23+
private const ASN1_LENGTH_2BYTES = '81';
2424

25-
private const string ASN1_BIG_INTEGER_LIMIT = '7f';
25+
private const ASN1_BIG_INTEGER_LIMIT = '7f';
2626

27-
private const string ASN1_NEGATIVE_INTEGER = '00';
27+
private const ASN1_NEGATIVE_INTEGER = '00';
2828

29-
private const int BYTE_SIZE = 2;
29+
private const BYTE_SIZE = 2;
3030

3131
public static function toAsn1(string $signature, int $length): string
3232
{

src/Library/Encryption/Algorithm/KeyEncryption/Util/RSACrypt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
/**
2525
* Optimal Asymmetric Encryption Padding (OAEP).
2626
*/
27-
public const int ENCRYPTION_OAEP = 1;
27+
public const ENCRYPTION_OAEP = 1;
2828

2929
/**
3030
* Use PKCS#1 padding.
3131
*/
32-
public const int ENCRYPTION_PKCS1 = 2;
32+
public const ENCRYPTION_PKCS1 = 2;
3333

3434
public static function encrypt(RSAKey $key, string $data, int $mode, ?string $hash = null): string
3535
{

src/Library/Encryption/Algorithm/KeyEncryptionAlgorithm.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
interface KeyEncryptionAlgorithm extends Algorithm
1010
{
11-
public const string MODE_DIRECT = 'dir';
11+
public const MODE_DIRECT = 'dir';
1212

13-
public const string MODE_ENCRYPT = 'enc';
13+
public const MODE_ENCRYPT = 'enc';
1414

15-
public const string MODE_WRAP = 'wrap';
15+
public const MODE_WRAP = 'wrap';
1616

17-
public const string MODE_AGREEMENT = 'agree';
17+
public const MODE_AGREEMENT = 'agree';
1818

1919
/**
2020
* Returns the key management mode used by the key encryption algorithm.

src/Library/Encryption/Serializer/CompactSerializer.php

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

1818
final readonly class CompactSerializer implements JWESerializer
1919
{
20-
public const string NAME = 'jwe_compact';
20+
public const NAME = 'jwe_compact';
2121

2222
#[Override]
2323
public function displayName(): string

src/Library/Encryption/Serializer/JSONFlattenedSerializer.php

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

1717
final readonly class JSONFlattenedSerializer implements JWESerializer
1818
{
19-
public const string NAME = 'jwe_json_flattened';
19+
public const NAME = 'jwe_json_flattened';
2020

2121
#[Override]
2222
public function displayName(): string

src/Library/Encryption/Serializer/JSONGeneralSerializer.php

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

1818
final readonly class JSONGeneralSerializer implements JWESerializer
1919
{
20-
public const string NAME = 'jwe_json_general';
20+
public const NAME = 'jwe_json_general';
2121

2222
#[Override]
2323
public function displayName(): string

src/Library/KeyManagement/Analyzer/Message.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
final readonly class Message implements JsonSerializable
1111
{
12-
final public const string SEVERITY_LOW = 'low';
12+
final public const SEVERITY_LOW = 'low';
1313

14-
final public const string SEVERITY_MEDIUM = 'medium';
14+
final public const SEVERITY_MEDIUM = 'medium';
1515

16-
final public const string SEVERITY_HIGH = 'high';
16+
final public const SEVERITY_HIGH = 'high';
1717

1818
private function __construct(
1919
private string $message,

src/Library/KeyManagement/Analyzer/ZxcvbnKeyAnalyzer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
final readonly class ZxcvbnKeyAnalyzer implements KeyAnalyzer
1616
{
17-
public const int STRENGTH_VERY_WEAK = 0;
17+
public const STRENGTH_VERY_WEAK = 0;
1818

19-
public const int STRENGTH_WEAK = 1;
19+
public const STRENGTH_WEAK = 1;
2020

21-
public const int STRENGTH_MEDIUM = 2;
21+
public const STRENGTH_MEDIUM = 2;
2222

23-
public const int STRENGTH_STRONG = 3;
23+
public const STRENGTH_STRONG = 3;
2424

25-
public const int STRENGTH_VERY_STRONG = 4;
25+
public const STRENGTH_VERY_STRONG = 4;
2626

2727
#[Override]
2828
public function analyze(JWK $jwk, MessageBag $bag): void

src/Library/Signature/Algorithm/Util/RSA.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
/**
2424
* Probabilistic Signature Scheme.
2525
*/
26-
public const int SIGNATURE_PSS = 1;
26+
public const SIGNATURE_PSS = 1;
2727

2828
/**
2929
* Use the PKCS#1.
3030
*/
31-
public const int SIGNATURE_PKCS1 = 2;
31+
public const SIGNATURE_PKCS1 = 2;
3232

3333
/**
3434
* @return non-empty-string

src/Library/Signature/Serializer/CompactSerializer.php

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

1717
final readonly class CompactSerializer extends Serializer
1818
{
19-
public const string NAME = 'jws_compact';
19+
public const NAME = 'jws_compact';
2020

2121
#[Override]
2222
public function displayName(): string

src/Library/Signature/Serializer/JSONFlattenedSerializer.php

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

1515
final readonly class JSONFlattenedSerializer extends Serializer
1616
{
17-
public const string NAME = 'jws_json_flattened';
17+
public const NAME = 'jws_json_flattened';
1818

1919
#[Override]
2020
public function displayName(): string

src/Library/Signature/Serializer/JSONGeneralSerializer.php

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

1818
final readonly class JSONGeneralSerializer extends Serializer
1919
{
20-
public const string NAME = 'jws_json_general';
20+
public const NAME = 'jws_json_general';
2121

2222
#[Override]
2323
public function displayName(): string

tests/ComposerJsonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class ComposerJsonTest extends TestCase
2020
{
21-
private const string SRC_DIR = __DIR__ . '/../src';
21+
private const SRC_DIR = __DIR__ . '/../src';
2222

2323
#[Test]
2424
public function packageDependenciesEqualRootDependencies(): void

tests/SignatureAlgorithm/Experimental/Blake2bTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
*/
1818
final class Blake2bTest extends TestCase
1919
{
20-
private const string KEY_ONE = 'GOu4rLyVCBxmxP-sbniU68ojAja5PkRdvv7vNvBCqDQ';
20+
private const KEY_ONE = 'GOu4rLyVCBxmxP-sbniU68ojAja5PkRdvv7vNvBCqDQ';
2121

22-
private const string KEY_TWO = 'Pu7gywseH-R5HLIWnMll4rEg1ltjUPq_P9WwEzAsAb8';
22+
private const KEY_TWO = 'Pu7gywseH-R5HLIWnMll4rEg1ltjUPq_P9WwEzAsAb8';
2323

24-
private const string CONTENTS = 'test';
24+
private const CONTENTS = 'test';
2525

26-
private const string EXPECTED_HASH_WITH_KEY_ONE = '_TG5kmkav_YGl3I9uQiv4cm1VN6Q0zPCom4G7-p74JU';
26+
private const EXPECTED_HASH_WITH_KEY_ONE = '_TG5kmkav_YGl3I9uQiv4cm1VN6Q0zPCom4G7-p74JU';
2727

28-
private const string SHORT_KEY = 'PIBQuM5PopdMxtmTWmyvNA';
28+
private const SHORT_KEY = 'PIBQuM5PopdMxtmTWmyvNA';
2929

3030
private JWK $keyOne;
3131

0 commit comments

Comments
 (0)