Skip to content

Commit 22ebeef

Browse files
committed
feat: allow PHP 8.1 updating dependencies
1 parent 8396adf commit 22ebeef

27 files changed

+163
-194
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
php-version:
23-
- "7.4"
23+
- "8.1"
2424

2525
steps:
2626
- name: "Checkout"
@@ -44,7 +44,7 @@ jobs:
4444
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
4545

4646
- name: "Run psalm"
47-
run: "vendor/bin/psalm --long-progress --output-format=github --report=psalm.sarif"
47+
run: "vendor/bin/psalm --long-progress --output-format=github --report=psalm.sarif --php-version=${{ matrix.php-version }}"
4848

4949
- name: "Upload SARIF file"
5050
uses: github/codeql-action/upload-sarif@v1
@@ -59,20 +59,18 @@ jobs:
5959
strategy:
6060
matrix:
6161
php-version:
62-
- "7.2"
63-
- "7.3"
6462
- "7.4"
63+
- "8.0"
64+
- "8.1"
6565
deps:
6666
- "--prefer-lowest"
6767
- ""
6868
coverage:
6969
- "false"
7070
include:
71-
- php-version: "7.4"
71+
- php-version: "8.1"
7272
deps: ""
7373
coverage: "true"
74-
- php-version: "8.0"
75-
deps: "--ignore-platform-req=php"
7674

7775
steps:
7876
- name: "Checkout"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/.phpstorm.meta.php
33
/phpstan
44
/.phpunit.result.cache
5-
/.php_cs.cache
5+
/.php-cs-fixer.cache
66
/composer.lock

.php-cs-fixer.dist.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/*
4+
* Additional rules or rules to override.
5+
* These rules will be added to default rules or will override them if the same key already exists.
6+
*/
7+
8+
$additionalRules = [
9+
'@PHP74Migration' => true,
10+
'@PHP74Migration:risky' => true,
11+
'visibility_required' => true,
12+
'heredoc_indentation' => true,
13+
'heredoc_to_nowdoc' => true,
14+
'no_null_property_initialization' => true,
15+
'no_useless_else' => true,
16+
'no_useless_return' => true,
17+
'global_namespace_import' => [
18+
'import_classes' => true,
19+
'import_constants' => true,
20+
'import_functions' => true,
21+
],
22+
'constant_case' => true,
23+
'declare_strict_types' => true,
24+
'indentation_type' => true,
25+
'no_superfluous_phpdoc_tags' => [
26+
'allow_mixed' => true,
27+
],
28+
'phpdoc_line_span' => [
29+
'const' => 'single',
30+
'method' => 'multi',
31+
'property' => 'single',
32+
],
33+
'phpdoc_trim_consecutive_blank_line_separation' => true,
34+
// risky rules
35+
'fopen_flag_order' => true,
36+
'fopen_flags' => true,
37+
'ereg_to_preg' => true,
38+
'implode_call' => true,
39+
'no_unset_on_property' => true,
40+
// custom
41+
'comment_to_phpdoc' => true,
42+
'phpdoc_to_comment' => false,
43+
];
44+
$rulesProvider = new Facile\CodingStandards\Rules\CompositeRulesProvider([
45+
new Facile\CodingStandards\Rules\DefaultRulesProvider(),
46+
new Facile\CodingStandards\Rules\ArrayRulesProvider($additionalRules),
47+
]);
48+
49+
$config = new PhpCsFixer\Config();
50+
$config->setRules($rulesProvider->getRules());
51+
52+
$finder = new PhpCsFixer\Finder();
53+
54+
/*
55+
* You can set manually these paths:
56+
*/
57+
$autoloadPathProvider = new Facile\CodingStandards\AutoloadPathProvider();
58+
$finder->in($autoloadPathProvider->getPaths());
59+
60+
$config->setFinder($finder);
61+
62+
return $config;

.php_cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.php_cs.dist

Lines changed: 0 additions & 27 deletions
This file was deleted.

composer.json

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
],
1212
"minimum-stability": "stable",
1313
"config": {
14-
"sort-packages": true
14+
"sort-packages": true,
15+
"allow-plugins": {
16+
"facile-it/facile-coding-standard": true,
17+
"laminas/laminas-component-installer": true
18+
}
1519
},
1620
"keywords": [
1721
"openid",
@@ -23,9 +27,9 @@
2327
"identity"
2428
],
2529
"require": {
26-
"php": "^7.2 || ^8.0",
30+
"php": "^7.4 || ^8.0",
2731
"ext-json": "*",
28-
"facile-it/php-jose-verifier": "^0.3.0",
32+
"facile-it/php-jose-verifier": "^0.3 || ^0.4",
2933
"php-http/discovery": "^1.6",
3034
"psr/http-client": "^1.0",
3135
"psr/http-client-implementation": "^1.0",
@@ -34,13 +38,12 @@
3438
"psr/http-message": "^1.0",
3539
"psr/http-message-implementation": "^1.0",
3640
"psr/http-server-middleware": "^1.0",
37-
"web-token/jwt-checker": "^2.0",
38-
"web-token/jwt-core": "^2.0",
39-
"web-token/jwt-easy": "^2.1",
40-
"web-token/jwt-encryption": "^2.0",
41-
"web-token/jwt-key-mgmt": "^2.0.7",
42-
"web-token/jwt-signature": "^2.0",
43-
"web-token/jwt-signature-algorithm-rsa": "^2.0"
41+
"web-token/jwt-checker": "^2.0 || ^3.0",
42+
"web-token/jwt-core": "^2.0 || ^3.0",
43+
"web-token/jwt-encryption": "^2.0 || ^3.0",
44+
"web-token/jwt-key-mgmt": "^2.0.7 || ^3.0",
45+
"web-token/jwt-signature": "^2.0 || ^3.0",
46+
"web-token/jwt-signature-algorithm-rsa": "^2.0 || ^3.0"
4447
},
4548
"autoload": {
4649
"files": [
@@ -64,36 +67,36 @@
6467
}
6568
},
6669
"require-dev": {
67-
"dflydev/fig-cookies": "^2.0",
68-
"facile-it/facile-coding-standard": "^0.4.1",
69-
"friendsofphp/php-cs-fixer": "^2.15",
70+
"dflydev/fig-cookies": "^2.0 || ^3.0",
71+
"facile-it/facile-coding-standard": "^0.5.2",
72+
"friendsofphp/php-cs-fixer": "^3.0",
7073
"laminas/laminas-component-installer": "^2.1",
7174
"laminas/laminas-config-aggregator": "^1.1",
7275
"laminas/laminas-di": "^3.1",
7376
"laminas/laminas-diactoros": "^2.1",
7477
"laminas/laminas-servicemanager": "^3.4",
7578
"php-http/cache-plugin": "^1.6",
7679
"php-http/curl-client": "^2.0",
77-
"php-http/guzzle7-adapter": "^0.1.0",
80+
"php-http/guzzle7-adapter": "^0.1.0 || ^1.0",
7881
"phpspec/prophecy": "^1.10.3",
7982
"phpspec/prophecy-phpunit": "^1.1 || ^2.0",
8083
"phpunit/phpunit": "^8.5.14 || ^9.3",
81-
"symfony/console": "^4.3 || ^5.0",
84+
"symfony/console": "^4.3 || ^5.0 || ^6.0",
8285
"vimeo/psalm": "^4.7.2",
83-
"web-token/jwt-encryption-algorithm-aescbc": "^2.0",
84-
"web-token/jwt-encryption-algorithm-aesgcm": "^2.0",
85-
"web-token/jwt-encryption-algorithm-aesgcmkw": "^2.0",
86-
"web-token/jwt-encryption-algorithm-aeskw": "^2.0",
87-
"web-token/jwt-encryption-algorithm-dir": "^2.0",
88-
"web-token/jwt-encryption-algorithm-ecdh-es": "^2.0",
89-
"web-token/jwt-encryption-algorithm-experimental": "^2.0",
90-
"web-token/jwt-encryption-algorithm-pbes2": "^2.0",
91-
"web-token/jwt-encryption-algorithm-rsa": "^2.0",
92-
"web-token/jwt-signature-algorithm-ecdsa": "^2.0",
93-
"web-token/jwt-signature-algorithm-eddsa": "^2.0",
94-
"web-token/jwt-signature-algorithm-experimental": "^2.0",
95-
"web-token/jwt-signature-algorithm-hmac": "^2.0",
96-
"web-token/jwt-signature-algorithm-none": "^2.0"
86+
"web-token/jwt-encryption-algorithm-aescbc": "^2.0 || ^3.0",
87+
"web-token/jwt-encryption-algorithm-aesgcm": "^2.0 || ^3.0",
88+
"web-token/jwt-encryption-algorithm-aesgcmkw": "^2.0 || ^3.0",
89+
"web-token/jwt-encryption-algorithm-aeskw": "^2.0 || ^3.0",
90+
"web-token/jwt-encryption-algorithm-dir": "^2.0 || ^3.0",
91+
"web-token/jwt-encryption-algorithm-ecdh-es": "^2.0 || ^3.0",
92+
"web-token/jwt-encryption-algorithm-experimental": "^2.0 || ^3.0",
93+
"web-token/jwt-encryption-algorithm-pbes2": "^2.0 || ^3.0",
94+
"web-token/jwt-encryption-algorithm-rsa": "^2.0 || ^3.0",
95+
"web-token/jwt-signature-algorithm-ecdsa": "^2.0 || ^3.0",
96+
"web-token/jwt-signature-algorithm-eddsa": "^2.0 || ^3.0",
97+
"web-token/jwt-signature-algorithm-experimental": "^2.0 || ^3.0",
98+
"web-token/jwt-signature-algorithm-hmac": "^2.0 || ^3.0",
99+
"web-token/jwt-signature-algorithm-none": "^2.0 || ^3.0"
97100
},
98101
"suggest": {
99102
"facile-it/php-oauth2-http-client": "To use a PSR HTTP client to interact with OAuth2/OpenID protected APIs",

conformance/src/Provider/ImplementationProvider.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ public function getCallableCode(callable $closure)
6060
// remove spaces based on first line
6161
if (preg_match('/^( +)/', $lines[0] ?? '', $matches)) {
6262
$toTrim = strlen($matches[1]);
63-
$lines = array_map(static function (string $line) use ($toTrim) {
64-
return preg_replace(sprintf('/^ {0,%d}/', $toTrim), '', $line);
65-
}, $lines);
63+
$lines = array_map(static fn (string $line) => preg_replace(sprintf('/^ {0,%d}/', $toTrim), '', $line), $lines);
6664
}
6765

6866
if ($this->indent) {
69-
$lines = array_map(function (string $line) {
70-
return str_repeat(' ', $this->indent) . $line;
71-
}, $lines);
67+
$lines = array_map(fn (string $line) => str_repeat(' ', $this->indent) . $line, $lines);
7268
}
7369

7470
return implode('', $lines);

conformance/src/RpTest/IdToken/RpIdTokenSigEncTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public function execute(TestInfo $testInfo): void
3636
$jwkEncAlg = JWKFactory::createRSAKey(2048, ['alg' => 'RSA1_5', 'use' => 'enc']);
3737

3838
$jwks = new JWKSet([$jwkSig, $jwkEncAlg]);
39-
$publicJwks = new JWKSet(array_map(function (JWK $jwk) {
40-
return $jwk->toPublic();
41-
}, $jwks->all()));
39+
$publicJwks = new JWKSet(array_map(fn (JWK $jwk) => $jwk->toPublic(), $jwks->all()));
4240

4341
$client = $this->registerClient($testInfo, [
4442
'id_token_signed_response_alg' => 'RS256',

conformance/src/RpTest/KeyRotation/RPKeyRotationOPEncKeyTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ public function execute(TestInfo $testInfo): void
3939
$jwkEncAlg = JWKFactory::createRSAKey(2048, ['alg' => 'RSA-OAEP', 'use' => 'enc']);
4040

4141
$jwks = new JWKSet([$jwkSig, $jwkEncAlg]);
42-
$publicJwks = new JWKSet(array_map(static function (JWK $jwk) {
43-
return $jwk->toPublic();
44-
}, $jwks->all()));
42+
$publicJwks = new JWKSet(array_map(static fn (JWK $jwk) => $jwk->toPublic(), $jwks->all()));
4543

4644
$client = $this->registerClient($testInfo, [
4745
'request_object_signing_alg' => 'RS256',

conformance/src/RpTest/UserInfoEndpoint/RPUserInfoEncTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public function execute(TestInfo $testInfo): void
3636
$jwkEncAlg = JWKFactory::createRSAKey(2048, ['alg' => 'RSA1_5', 'use' => 'enc']);
3737

3838
$jwks = new JWKSet([$jwkEncAlg]);
39-
$publicJwks = new JWKSet(array_map(static function (JWK $jwk) {
40-
return $jwk->toPublic();
41-
}, $jwks->all()));
39+
$publicJwks = new JWKSet(array_map(static fn (JWK $jwk) => $jwk->toPublic(), $jwks->all()));
4240

4341
$client = $this->registerClient($testInfo, [
4442
'userinfo_signed_response_alg' => 'none',

0 commit comments

Comments
 (0)