Skip to content

Commit 5ac374c

Browse files
authored
Global upgrade of the dev dependencies + PHP8.4 tests (#60)
1 parent 4a4c785 commit 5ac374c

Some content is hidden

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

47 files changed

+653
-381
lines changed

.github/workflows/integrate.yml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
- "8.1"
5858
- "8.2"
5959
- "8.3"
60+
- "8.4"
6061
dependencies:
6162
- "lowest"
6263
- "highest"

composer.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,16 @@
5656
"require-dev": {
5757
"ext-gmp": "*",
5858
"ext-openssl": "*",
59-
"ekino/phpstan-banned-code": "^1.0",
60-
"infection/infection": "^0.28",
59+
"ekino/phpstan-banned-code": "^1.0|^2.0|^3.0",
60+
"infection/infection": "^0.28|^0.29",
6161
"php-parallel-lint/php-parallel-lint": "^1.3",
62-
"phpstan/extension-installer": "^1.3",
63-
"phpstan/phpstan": "^1.8",
64-
"phpstan/phpstan-beberlei-assert": "^1.0",
65-
"phpstan/phpstan-deprecation-rules": "^1.0",
66-
"phpstan/phpstan-phpunit": "^1.1",
67-
"phpstan/phpstan-strict-rules": "^1.3",
68-
"rector/rector": "^1.0",
62+
"phpstan/extension-installer": "^1.3|^2.0",
63+
"phpstan/phpstan": "^1.8|^2.0",
64+
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
65+
"phpstan/phpstan-phpunit": "^1.1|^2.0",
66+
"phpstan/phpstan-strict-rules": "^1.3|^2.0",
67+
"rector/rector": "^1.0|^2.0",
6968
"roave/security-advisories": "dev-latest",
70-
"symfony/phpunit-bridge": "^6.4|^7.0",
7169
"symfony/string": "^6.4|^7.0",
7270
"symfony/var-dumper": "^6.4|^7.0",
7371
"symplify/easy-coding-standard": "^12.0",

phpstan-baseline.neon

+470-178
Large diffs are not rendered by default.

phpstan.neon

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ parameters:
22
level: max
33
paths:
44
- src
5-
checkMissingIterableValueType: true
6-
checkGenericClassInNonGenericObjectType: true
75
checkUninitializedProperties: true
86
treatPhpDocTypesAsCertain: false
97
includes:

phpunit.xml.dist

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@
3535
</include>
3636
</source>
3737
<php>
38-
<ini name="display_errors" value="1"/>
3938
<ini name="error_reporting" value="-1"/>
40-
<ini name="memory_limit" value="-1"/>
41-
<server name="APP_ENV" value="test" force="true"/>
39+
<ini name="xdebug.show_exception_trace" value="0"/>
40+
<ini name="display_errors" value="1"/>
4241
<server name="SHELL_VERBOSITY" value="-1"/>
43-
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
44-
<server name="SYMFONY_PHPUNIT_VERSION" value="10"/>
45-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
4642
</php>
4743
</phpunit>

rector.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,23 @@
66
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
77
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\DataProviderArrayItemsNewLinedRector;
88
use Rector\PHPUnit\Set\PHPUnitSetList;
9-
use Rector\Set\ValueObject\LevelSetList;
109
use Rector\Set\ValueObject\SetList;
1110
use Rector\Symfony\Set\SymfonySetList;
12-
use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector;
1311
use Rector\ValueObject\PhpVersion;
1412

1513
return static function (RectorConfig $config): void {
1614
$config->import(SetList::DEAD_CODE);
17-
$config->import(LevelSetList::UP_TO_PHP_81);
15+
$config->import(SetList::PHP_81);
1816
$config->import(SymfonySetList::SYMFONY_50_TYPES);
19-
$config->import(SymfonySetList::SYMFONY_52_VALIDATOR_ATTRIBUTES);
2017
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
2118
$config->import(SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION);
22-
$config->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
2319
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
2420
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
2521
$config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']);
26-
$config->skip([
27-
DataProviderArrayItemsNewLinedRector::class,
28-
PreferPHPUnitThisCallRector::class,
29-
StringToArrayArgumentProcessRector::class => [__DIR__ . '/tests'],
30-
]);
22+
$config->skip([DataProviderArrayItemsNewLinedRector::class, PreferPHPUnitThisCallRector::class]);
23+
$config::configure()->withComposerBased(twig: true, phpunit: true);
24+
$config::configure()->withPhpSets();
25+
$config::configure()->withAttributesSets();
3126
$config->phpVersion(PhpVersion::PHP_81);
3227
$config->parallel();
3328
$config->importNames();

src/ASN1/Component/Length.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use function count;
1414
use function mb_strlen;
1515
use function ord;
16+
use function sprintf;
1617

1718
/**
1819
* Class to represent BER/DER length octets.

src/ASN1/Element.php

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
use UnexpectedValueException;
4747
use function array_key_exists;
4848
use function mb_strlen;
49+
use function sprintf;
4950

5051
/**
5152
* Base class for all ASN.1 type elements.

src/ASN1/Type/BaseString.php

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use InvalidArgumentException;
88
use SpomkyLabs\Pki\ASN1\Element;
99
use Stringable;
10+
use function sprintf;
1011

1112
/**
1213
* Base class for all string types.

src/ASN1/Type/Primitive/GeneralizedTime.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ final class GeneralizedTime extends BaseTime
3434
* @var string
3535
*/
3636
final public const REGEX = '#^' .
37-
'(\d\d\d\d)' . // YYYY
38-
'(\d\d)' . // MM
39-
'(\d\d)' . // DD
40-
'(\d\d)' . // hh
41-
'(\d\d)' . // mm
42-
'(\d\d)' . // ss
43-
'(?:\.(\d+))?' . // frac
44-
'Z' . // TZ
45-
'$#';
37+
'(\d\d\d\d)' . // YYYY
38+
'(\d\d)' . // MM
39+
'(\d\d)' . // DD
40+
'(\d\d)' . // hh
41+
'(\d\d)' . // mm
42+
'(\d\d)' . // ss
43+
'(?:\.(\d+))?' . // frac
44+
'Z' . // TZ
45+
'$#';
4646

4747
/**
4848
* Cached formatted date.

src/ASN1/Type/Primitive/Number.php

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use function is_int;
1515
use function is_scalar;
1616
use function is_string;
17+
use function sprintf;
1718
use function strval;
1819

1920
abstract class Number extends Element

src/ASN1/Type/Primitive/ObjectIdentifier.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use function is_int;
2121
use function mb_strlen;
2222
use function ord;
23+
use function sprintf;
2324

2425
/**
2526
* Implements *OBJECT IDENTIFIER* type.

src/ASN1/Type/Primitive/Real.php

+20-19
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use function in_array;
2323
use function mb_strlen;
2424
use function ord;
25+
use function sprintf;
2526
use const INF;
2627

2728
/**
@@ -38,31 +39,31 @@ final class Real extends Element implements Stringable
3839
* @var string
3940
*/
4041
final public const NR1_REGEX = '/^\s*' .
41-
'(?<s>[+\-])?' . // sign
42-
'(?<i>\d+)' . // integer
43-
'$/';
42+
'(?<s>[+\-])?' . // sign
43+
'(?<i>\d+)' . // integer
44+
'$/';
4445

4546
/**
4647
* Regex pattern to parse NR2 form number.
4748
*
4849
* @var string
4950
*/
5051
final public const NR2_REGEX = '/^\s*' .
51-
'(?<s>[+\-])?' . // sign
52-
'(?<d>(?:\d+[\.,]\d*)|(?:\d*[\.,]\d+))' . // decimal number
53-
'$/';
52+
'(?<s>[+\-])?' . // sign
53+
'(?<d>(?:\d+[\.,]\d*)|(?:\d*[\.,]\d+))' . // decimal number
54+
'$/';
5455

5556
/**
5657
* Regex pattern to parse NR3 form number.
5758
*
5859
* @var string
5960
*/
6061
final public const NR3_REGEX = '/^\s*' .
61-
'(?<ms>[+\-])?' . // mantissa sign
62-
'(?<m>(?:\d+[\.,]\d*)|(?:\d*[\.,]\d+))' . // mantissa
63-
'[Ee](?<es>[+\-])?' . // exponent sign
64-
'(?<e>\d+)' . // exponent
65-
'$/';
62+
'(?<ms>[+\-])?' . // mantissa sign
63+
'(?<m>(?:\d+[\.,]\d*)|(?:\d*[\.,]\d+))' . // mantissa
64+
'[Ee](?<es>[+\-])?' . // exponent sign
65+
'(?<e>\d+)' . // exponent
66+
'$/';
6667

6768
/**
6869
* Regex pattern to parse PHP exponent number format.
@@ -72,14 +73,14 @@ final class Real extends Element implements Stringable
7273
* @var string
7374
*/
7475
final public const PHP_EXPONENT_DNUM = '/^' .
75-
'(?<ms>[+\-])?' . // sign
76-
'(?<m>' .
77-
'\d+' . // LNUM
78-
'|' .
79-
'(?:\d*\.\d+|\d+\.\d*)' . // DNUM
80-
')[eE]' .
81-
'(?<es>[+\-])?(?<e>\d+)' . // exponent
82-
'$/';
76+
'(?<ms>[+\-])?' . // sign
77+
'(?<m>' .
78+
'\d+' . // LNUM
79+
'|' .
80+
'(?:\d*\.\d+|\d+\.\d*)' . // DNUM
81+
')[eE]' .
82+
'(?<es>[+\-])?(?<e>\d+)' . // exponent
83+
'$/';
8384

8485
/**
8586
* Exponent when value is positive or negative infinite.

src/ASN1/Type/Primitive/RelativeOID.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use function chr;
1919
use function is_int;
2020
use function ord;
21+
use function sprintf;
2122

2223
/**
2324
* Implements *RELATIVE-OID* type.

src/ASN1/Type/Primitive/UTCTime.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ final class UTCTime extends BaseTime
3030
* @var string
3131
*/
3232
final public const REGEX = '#^' .
33-
'(\d\d)' . // YY
34-
'(\d\d)' . // MM
35-
'(\d\d)' . // DD
36-
'(\d\d)' . // hh
37-
'(\d\d)' . // mm
38-
'(\d\d)' . // ss
39-
'Z' . // TZ
40-
'$#';
33+
'(\d\d)' . // YY
34+
'(\d\d)' . // MM
35+
'(\d\d)' . // DD
36+
'(\d\d)' . // hh
37+
'(\d\d)' . // mm
38+
'(\d\d)' . // ss
39+
'Z' . // TZ
40+
'$#';
4141

4242
private function __construct(DateTimeImmutable $dt)
4343
{

src/ASN1/Type/Tagged/ImplicitlyTaggedType.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use SpomkyLabs\Pki\ASN1\Feature\ElementBase;
1111
use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;
1212
use UnexpectedValueException;
13+
use function sprintf;
1314

1415
/**
1516
* Implements implicit tagging mode.

src/ASN1/Type/UnspecifiedType.php

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use SpomkyLabs\Pki\ASN1\Type\Tagged\ApplicationType;
3838
use SpomkyLabs\Pki\ASN1\Type\Tagged\PrivateType;
3939
use UnexpectedValueException;
40+
use function sprintf;
4041

4142
/**
4243
* Decorator class to wrap an element without already knowing the specific underlying type.

src/CryptoBridge/Crypto/OpenSSLCrypto.php

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use UnexpectedValueException;
1818
use function array_key_exists;
1919
use function mb_strlen;
20+
use function sprintf;
2021
use const OPENSSL_ALGO_MD4;
2122
use const OPENSSL_ALGO_MD5;
2223
use const OPENSSL_ALGO_SHA1;

src/CryptoEncoding/PEM.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ final class PEM implements Stringable
4747
* @var string
4848
*/
4949
final public const PEM_REGEX = '/' .
50-
/* line start */
51-
'(?:^|[\r\n])' .
52-
/* header */
53-
'-----BEGIN (.+?)-----[\r\n]+' .
54-
/* payload */
55-
'(.+?)' .
56-
/* trailer */
57-
'[\r\n]+-----END \\1-----' .
58-
'/ms';
50+
/* line start */
51+
'(?:^|[\r\n])' .
52+
/* header */
53+
'-----BEGIN (.+?)-----[\r\n]+' .
54+
/* payload */
55+
'(.+?)' .
56+
/* trailer */
57+
'[\r\n]+-----END \\1-----' .
58+
'/ms';
5959

6060
/**
6161
* @param string $type Content type

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212
use UnexpectedValueException;
1313

1414
/*
15-
From RFC 5480 - 2.1.1. Unrestricted Algorithm Identifier and Parameters:
16-
17-
The parameter for id-ecPublicKey is as follows and MUST always be
18-
present:
19-
20-
ECParameters ::= CHOICE {
21-
namedCurve OBJECT IDENTIFIER
22-
-- implicitCurve NULL
23-
-- specifiedCurve SpecifiedECDomain
24-
}
15+
* From RFC 5480 - 2.1.1. Unrestricted Algorithm Identifier and Parameters:
16+
* The parameter for id-ecPublicKey is as follows and MUST always be
17+
* present:
18+
* ECParameters ::= CHOICE {
19+
* namedCurve OBJECT IDENTIFIER
20+
* -- implicitCurve NULL
21+
* -- specifiedCurve SpecifiedECDomain
22+
* }
2523
*/
2624

2725
/**

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/RFC8410EdAlgorithmIdentifier.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010
use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\SpecificAlgorithmIdentifier;
1111

1212
/*
13-
From RFC 8410:
14-
15-
For all of the OIDs, the parameters MUST be absent.
16-
17-
It is possible to find systems that require the parameters to be
18-
present. This can be due to either a defect in the original 1997
19-
syntax or a programming error where developers never got input where
20-
this was not true. The optimal solution is to fix these systems;
21-
where this is not possible, the problem needs to be restricted to
22-
that subsystem and not propagated to the Internet.
13+
* From RFC 8410:
14+
* For all of the OIDs, the parameters MUST be absent.
15+
* It is possible to find systems that require the parameters to be
16+
* present. This can be due to either a defect in the original 1997
17+
* syntax or a programming error where developers never got input where
18+
* this was not true. The optimal solution is to fix these systems;
19+
* where this is not possible, the problem needs to be restricted to
20+
* that subsystem and not propagated to the Internet.
2321
*/
2422

2523
/**

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/RFC8410XAlgorithmIdentifier.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
use SpomkyLabs\Pki\CryptoTypes\AlgorithmIdentifier\SpecificAlgorithmIdentifier;
1010

1111
/*
12-
From RFC 8410:
13-
14-
For all of the OIDs, the parameters MUST be absent.
15-
16-
It is possible to find systems that require the parameters to be
17-
present. This can be due to either a defect in the original 1997
18-
syntax or a programming error where developers never got input where
19-
this was not true. The optimal solution is to fix these systems;
20-
where this is not possible, the problem needs to be restricted to
21-
that subsystem and not propagated to the Internet.
12+
* From RFC 8410:
13+
* For all of the OIDs, the parameters MUST be absent.
14+
* It is possible to find systems that require the parameters to be
15+
* present. This can be due to either a defect in the original 1997
16+
* syntax or a programming error where developers never got input where
17+
* this was not true. The optimal solution is to fix these systems;
18+
* where this is not possible, the problem needs to be restricted to
19+
* that subsystem and not propagated to the Internet.
2220
*/
2321

2422
/**

0 commit comments

Comments
 (0)