Skip to content

Commit 1b273bd

Browse files
authored
Refactor constructors and update dependencies. (#617)
* Refactor constructors and update dependencies. Simplified constructors by removing unnecessary line breaks. Updated `composer.json` dependencies to newer versions, ensuring compatibility and alignment with modern standards. Adjusted test data to a cleaner format, improving readability and maintainability. * Update composer dependencies and simplify version constraints Removed the unnecessary "ext-json" dependency in both files. Simplified the "brick/math" version constraint for clarity and consistency. No functional changes introduced. * Update workflow to use 'ubuntu-latest' for integration jobs Switched from 'ubuntu-20.04' to 'ubuntu-latest' in the GitHub Actions workflow. This ensures the use of the most up-to-date environment for integration testing, reducing potential compatibility issues. * Update phpstan-baseline.neon to reflect updated method signatures Adjusted error baseline messages to correspond with the renamed classes and methods in the dependency injection sources. This ensures the baseline reflects the current code structure and resolves outdated references.
1 parent 2772f20 commit 1b273bd

File tree

7 files changed

+37
-41
lines changed

7 files changed

+37
-41
lines changed

.github/workflows/integrate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
needs:
210210
- "byte_level"
211211
- "syntax_errors"
212-
runs-on: "ubuntu-20.04"
212+
runs-on: "ubuntu-latest"
213213
steps:
214214
- name: "Checkout code"
215215
uses: "actions/checkout@v4"

composer.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@
4747
},
4848
"require": {
4949
"php": ">=8.2",
50-
"ext-json": "*",
5150
"ext-openssl": "*",
52-
"brick/math": "^0.12 || ^0.13",
51+
"brick/math": "^0.12|^0.13",
5352
"psr/clock": "^1.0",
5453
"psr/event-dispatcher": "^1.0",
5554
"spomky-labs/pki-framework": "^1.2.1",
@@ -67,7 +66,7 @@
6766
"ekino/phpstan-banned-code": "^2.0|^3.0",
6867
"ergebnis/phpunit-slow-test-detector": "^2.14",
6968
"infection/infection": "^0.29",
70-
"matthiasnoback/symfony-config-test": "5.1.x-dev",
69+
"matthiasnoback/symfony-config-test": "^6.0",
7170
"paragonie/sodium_compat": "^1.20|^2.0",
7271
"php-parallel-lint/php-parallel-lint": "^1.3",
7372
"phpbench/phpbench": "^1.2",
@@ -78,14 +77,14 @@
7877
"phpstan/phpstan-phpunit": "^1.1|^2.0",
7978
"phpstan/phpstan-strict-rules": "^1.4|^2.0",
8079
"phpstan/phpstan-symfony": "^1.3|^2.0",
81-
"phpunit/phpunit": "^10.5.10|^11.0",
82-
"qossmic/deptrac": "^2.0",
80+
"phpunit/phpunit": "^10.5.10|^11.0|^12.0",
81+
"deptrac/deptrac": "^2.0",
8382
"rector/rector": "^1.0|^2.0",
8483
"roave/security-advisories": "dev-latest",
8584
"spomky-labs/aes-key-wrap": "^7.0",
8685
"staabm/phpstan-dba": "^0.2.79|^0.3",
8786
"staabm/phpstan-todo-by": "^0.1.25|^0.2",
88-
"struggle-for-php/sfp-phpstan-psr-log": "^0.20|^0.21|^0.22|^0.23",
87+
"struggle-for-php/sfp-phpstan-psr-log": "^0.20|^0.21|^0.22|^0.23|^0.24",
8988
"symfony/browser-kit": "^7.0",
9089
"symfony/http-client": "^7.0",
9190
"symfony/clock": "^7.0",

phpstan-baseline.neon

+8-8
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ parameters:
223223
path: src/Bundle/DependencyInjection/Source/Checker/CheckerSource.php
224224

225225
-
226-
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:load\(\) expects array, mixed given\.$#'
226+
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Checker\\ClaimChecker\:\:load\(\) expects array, mixed given\.$#'
227227
identifier: argument.type
228228
count: 1
229229
path: src/Bundle/DependencyInjection/Source/Checker/CheckerSource.php
230230

231231
-
232-
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
232+
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Checker\\ClaimChecker\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
233233
identifier: argument.type
234234
count: 1
235235
path: src/Bundle/DependencyInjection/Source/Checker/CheckerSource.php
@@ -757,13 +757,13 @@ parameters:
757757
path: src/Bundle/DependencyInjection/Source/Encryption/EncryptionSource.php
758758

759759
-
760-
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:load\(\) expects array, mixed given\.$#'
760+
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Encryption\\JWEBuilder\:\:load\(\) expects array, mixed given\.$#'
761761
identifier: argument.type
762762
count: 1
763763
path: src/Bundle/DependencyInjection/Source/Encryption/EncryptionSource.php
764764

765765
-
766-
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
766+
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Encryption\\AbstractEncryptionSource\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
767767
identifier: argument.type
768768
count: 1
769769
path: src/Bundle/DependencyInjection/Source/Encryption/EncryptionSource.php
@@ -2365,13 +2365,13 @@ parameters:
23652365
path: src/Bundle/DependencyInjection/Source/NestedToken/NestedToken.php
23662366

23672367
-
2368-
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:load\(\) expects array, mixed given\.$#'
2368+
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\NestedToken\\NestedTokenBuilder\:\:load\(\) expects array, mixed given\.$#'
23692369
identifier: argument.type
23702370
count: 1
23712371
path: src/Bundle/DependencyInjection/Source/NestedToken/NestedToken.php
23722372

23732373
-
2374-
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
2374+
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\NestedToken\\NestedTokenBuilder\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
23752375
identifier: argument.type
23762376
count: 1
23772377
path: src/Bundle/DependencyInjection/Source/NestedToken/NestedToken.php
@@ -3367,13 +3367,13 @@ parameters:
33673367
path: src/Bundle/DependencyInjection/Source/Signature/SignatureSource.php
33683368

33693369
-
3370-
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:load\(\) expects array, mixed given\.$#'
3370+
message: '#^Parameter \#1 \$configs of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Signature\\JWSBuilder\:\:load\(\) expects array, mixed given\.$#'
33713371
identifier: argument.type
33723372
count: 1
33733373
path: src/Bundle/DependencyInjection/Source/Signature/SignatureSource.php
33743374

33753375
-
3376-
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Source\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
3376+
message: '#^Parameter \#1 \$node of method Jose\\Bundle\\JoseFramework\\DependencyInjection\\Source\\Signature\\AbstractSignatureSource\:\:getNodeDefinition\(\) expects Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition, mixed given\.$#'
33773377
identifier: argument.type
33783378
count: 1
33793379
path: src/Bundle/DependencyInjection/Source/Signature/SignatureSource.php

src/Library/Encryption/JWEBuilder.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ class JWEBuilder
4646

4747
private readonly AlgorithmManager $contentEncryptionAlgorithmManager;
4848

49-
public function __construct(
50-
AlgorithmManager $algorithmManager,
51-
) {
49+
public function __construct(AlgorithmManager $algorithmManager)
50+
{
5251
$keyEncryptionAlgorithms = [];
5352
$contentEncryptionAlgorithms = [];
5453
foreach ($algorithmManager->all() as $algorithm) {

src/Library/Encryption/JWEDecrypter.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ class JWEDecrypter
2828

2929
private readonly AlgorithmManager $contentEncryptionAlgorithmManager;
3030

31-
public function __construct(
32-
AlgorithmManager $algorithmManager
33-
) {
31+
public function __construct(AlgorithmManager $algorithmManager)
32+
{
3433
$keyEncryptionAlgorithms = [];
3534
$contentEncryptionAlgorithms = [];
3635
foreach ($algorithmManager->all() as $key => $algorithm) {

src/Library/composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
},
4040
"require": {
4141
"php": ">=8.2",
42-
"ext-json": "*",
43-
"brick/math": "^0.12 || ^0.13",
42+
"brick/math": "^0.12|^0.13",
4443
"psr/clock": "^1.0",
4544
"spomky-labs/pki-framework": "^1.2.1"
4645
},

tests/Component/KeyManagement/JWKFactoryTest.php

+18-18
Original file line numberDiff line numberDiff line change
@@ -246,67 +246,67 @@ public function loadKeyPEMEncoded(string $filename, array $expectedValues): void
246246
public static function dataKeys(): iterable
247247
{
248248
yield [
249-
'filename' => __DIR__ . '/Keys/ED/public-ed448.pem',
250-
'expectedValues' => [
249+
__DIR__ . '/Keys/ED/public-ed448.pem',
250+
[
251251
'kty' => 'OKP',
252252
'crv' => 'Ed448',
253253
'x' => 'wwHKDV7s4fBhmFSTzYorlaToGXNcsa7SakZdekT_sexD5ENj5lWP6_KX9_u--w_QSm80rNOodj0A',
254254
],
255255
];
256256
yield [
257-
'filename' => __DIR__ . '/Keys/ED/public-ed25519.pem',
258-
'expectedValues' => [
257+
__DIR__ . '/Keys/ED/public-ed25519.pem',
258+
[
259259
'kty' => 'OKP',
260260
'crv' => 'Ed25519',
261261
'x' => 'wrI33AEj15KHHYplueUE5cnJKtbM8oVHFf6wGnw2oOE',
262262
],
263263
];
264264
yield [
265-
'filename' => __DIR__ . '/Keys/ED/public-X448.pem',
266-
'expectedValues' => [
265+
__DIR__ . '/Keys/ED/public-X448.pem',
266+
[
267267
'kty' => 'OKP',
268268
'crv' => 'X448',
269269
'x' => 'UoPD73NQACC8A-otDUVun4IrMsk775ShMRf4ThDrq4xY2eAI-pOIVujrvBXXd9g8gUNwBT0fmnc',
270270
],
271271
];
272272
yield [
273-
'filename' => __DIR__ . '/Keys/ED/public-X25519.pem',
274-
'expectedValues' => [
273+
__DIR__ . '/Keys/ED/public-X25519.pem',
274+
[
275275
'kty' => 'OKP',
276276
'crv' => 'X25519',
277277
'x' => '3OJLiffmOCQGtil23QGyn0nk9EBKoZx6P-6o-EnsBB4',
278278
],
279279
];
280280
yield [
281-
'filename' => __DIR__ . '/Keys/ED/private-ed448.pem',
282-
'expectedValues' => [
281+
__DIR__ . '/Keys/ED/private-ed448.pem',
282+
[
283283
'kty' => 'OKP',
284284
'crv' => 'Ed448',
285285
'x' => 'wwHKDV7s4fBhmFSTzYorlaToGXNcsa7SakZdekT_sexD5ENj5lWP6_KX9_u--w_QSm80rNOodj0A',
286286
'd' => '0GXSbNLOh7NQBlwoF8y2WJmjeP5Puif4_JL4ihFUzRLrb_3r4cH8l_HWJA-2ffY62LEB_ozsehG5',
287287
],
288288
];
289289
yield [
290-
'filename' => __DIR__ . '/Keys/ED/private-X448.pem',
291-
'expectedValues' => [
290+
__DIR__ . '/Keys/ED/private-X448.pem',
291+
[
292292
'kty' => 'OKP',
293293
'crv' => 'X448',
294294
'x' => 'UoPD73NQACC8A-otDUVun4IrMsk775ShMRf4ThDrq4xY2eAI-pOIVujrvBXXd9g8gUNwBT0fmnc',
295295
'd' => 'OHZK0Fp9MAAmk0yZekiAkB8qxpCVAF4dT2x_xmFNDdCTnyDvixaiZ0NSRpAdR59tA6OJmOFfbck',
296296
],
297297
];
298298
yield [
299-
'filename' => __DIR__ . '/Keys/ED/private-ed25519.pem',
300-
'expectedValues' => [
299+
__DIR__ . '/Keys/ED/private-ed25519.pem',
300+
[
301301
'kty' => 'OKP',
302302
'crv' => 'Ed25519',
303303
'x' => 'wrI33AEj15KHHYplueUE5cnJKtbM8oVHFf6wGnw2oOE',
304304
'd' => 'Pr9AxZivB-zSq95wLrZfYa7DQ3TUPqZTkP_0w33r3rc',
305305
],
306306
];
307307
yield [
308-
'filename' => __DIR__ . '/Keys/ED/private-secp384r1-with-public.pem',
309-
'expectedValues' => [
308+
__DIR__ . '/Keys/ED/private-secp384r1-with-public.pem',
309+
[
310310
'kty' => 'EC',
311311
'crv' => 'P-384',
312312
'd' => '31taDOPQnlNl2aBC_EaGTqVGjGN_qg6iuLwP6cVTmhKMQ5PTL67wS6mmyKi8GdVP',
@@ -315,8 +315,8 @@ public static function dataKeys(): iterable
315315
],
316316
];
317317
yield [
318-
'filename' => __DIR__ . '/Keys/ED/private-X25519.pem',
319-
'expectedValues' => [
318+
__DIR__ . '/Keys/ED/private-X25519.pem',
319+
[
320320
'kty' => 'OKP',
321321
'crv' => 'X25519',
322322
'x' => '3OJLiffmOCQGtil23QGyn0nk9EBKoZx6P-6o-EnsBB4',

0 commit comments

Comments
 (0)