Skip to content

Commit

Permalink
Safe calls and deprecation fixed (#470)
Browse files Browse the repository at this point in the history
* Safe calls and deprecation fixed
  • Loading branch information
Spomky authored Sep 8, 2023
1 parent 77586f3 commit 8128dff
Show file tree
Hide file tree
Showing 91 changed files with 719 additions and 356 deletions.
7 changes: 4 additions & 3 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Such releases will be considered as "pre-releases".
## Minor Release Support Matrix

| Version | Supported |
| ------- | ------------------ |
|---------|--------------------|
| 4.8.x | :white_check_mark: |
| 4.7.x | :white_check_mark: |
| 4.6.x | :white_check_mark: |
| 4.5.x | :white_check_mark: |
| 3.3.x | :white_check_mark: |
| <4.6.x | :x: |
| 3.3.x | :x: |
| < 3.3.x | :x: |
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"doctrine/orm": "^2.13",
"ekino/phpstan-banned-code": "^1.0",
"infection/infection": "^0.27",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
"matthiasnoback/symfony-dependency-injection-test": "^4.3|^5.0",
"php-http/curl-client": "^2.2",
"php-http/mock-client": "^1.5",
"php-parallel-lint/php-parallel-lint": "^1.3",
Expand All @@ -112,7 +112,7 @@
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10.1",
"qossmic/deptrac-shim": "^1.0",
"rector/rector": "^0.17",
"rector/rector": "^0.18",
"roave/security-advisories": "dev-latest",
"symfony/asset": "^6.3",
"symfony/asset-mapper": "^6.3",
Expand Down
9 changes: 2 additions & 7 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,9 @@
'import_functions' => true,
]);
$config->skip([
MethodChainingIndentationFixer::class => [
__DIR__ . '*/DependencyInjection/Configuration.php',
],
MethodChainingIndentationFixer::class => [__DIR__ . '*/DependencyInjection/Configuration.php'],
]);

$config->parallel();
$config->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']);
};
120 changes: 105 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,29 @@ parameters:
path: src/symfony/src/Doctrine/Type/Base64BinaryDataType.php

-
message: "#^Parameter \\#1 \\$data of static method Webauthn\\\\PublicKeyCredentialDescriptorCollection\\:\\:createFromString\\(\\) expects string, mixed given\\.$#"
message: "#^@readonly property Webauthn\\\\Bundle\\\\Doctrine\\\\Type\\\\PublicKeyCredentialDescriptorCollection\\:\\:\\$publicKeyCredentialDescriptors is already assigned\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollectionType.php
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^@readonly property Webauthn\\\\Bundle\\\\Doctrine\\\\Type\\\\PublicKeyCredentialDescriptorCollection\\:\\:\\$publicKeyCredentialDescriptors is assigned outside of the constructor\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Method Webauthn\\\\Bundle\\\\Doctrine\\\\Type\\\\PublicKeyCredentialDescriptorCollection\\:\\:jsonSerialize\\(\\) should return array\\<array\\<string, mixed\\>\\> but returns array\\<string, Webauthn\\\\PublicKeyCredentialDescriptor\\>\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(array\\)\\: Webauthn\\\\PublicKeyCredentialDescriptor given\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#1 \\$json of static method Webauthn\\\\Bundle\\\\Doctrine\\\\Type\\\\PublicKeyCredentialDescriptorCollection\\:\\:createFromArray\\(\\) expects array, mixed given\\.$#"
count: 1
path: src/symfony/src/Doctrine/Type/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#1 \\$data of static method Webauthn\\\\PublicKeyCredentialDescriptor\\:\\:createFromString\\(\\) expects string, mixed given\\.$#"
Expand All @@ -986,6 +1006,11 @@ parameters:
count: 1
path: src/symfony/src/Repository/DoctrineCredentialSourceRepository.php

-
message: "#^Class Webauthn\\\\Bundle\\\\Repository\\\\PublicKeyCredentialSourceRepository extends generic class Webauthn\\\\Bundle\\\\Repository\\\\DoctrineCredentialSourceRepository but does not specify its types\\: T$#"
count: 1
path: src/symfony/src/Repository/PublicKeyCredentialSourceRepository.php

-
message: "#^Fetching class constant class of deprecated class Webauthn\\\\PublicKeyCredentialSourceRepository\\.$#"
count: 2
Expand Down Expand Up @@ -1026,7 +1051,7 @@ parameters:
-
message: """
#^Class Webauthn\\\\Bundle\\\\Security\\\\Authentication\\\\Token\\\\WebauthnToken implements deprecated interface Webauthn\\\\Bundle\\\\Security\\\\Authentication\\\\Token\\\\WebauthnTokenInterface\\:
since 4\\.7\\.0, use \\{@see WebauthnTokenInterface\\} instead$#
since 4\\.7\\.0, use \\{@see WebauthnToken\\} instead$#
"""
count: 1
path: src/symfony/src/Security/Authentication/Token/WebauthnToken.php
Expand Down Expand Up @@ -1331,6 +1356,26 @@ parameters:
count: 1
path: src/symfony/src/Service/AuthenticatorAttestationResponseValidator.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$attestation is assigned outside of its declaring class\\.$#"
count: 1
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$authenticatorSelection is assigned outside of its declaring class\\.$#"
count: 1
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$excludeCredentials is assigned outside of its declaring class\\.$#"
count: 1
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialOptions\\:\\:\\$timeout is assigned outside of its declaring class\\.$#"
count: 1
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php

-
message: "#^Cannot access offset 'attestation…' on mixed\\.$#"
count: 1
Expand Down Expand Up @@ -1471,6 +1516,11 @@ parameters:
count: 1
path: src/symfony/src/Service/PublicKeyCredentialCreationOptionsFactory.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialOptions\\:\\:\\$timeout is assigned outside of its declaring class\\.$#"
count: 1
path: src/symfony/src/Service/PublicKeyCredentialRequestOptionsFactory.php

-
message: "#^Cannot access offset 'challenge_length' on mixed\\.$#"
count: 1
Expand Down Expand Up @@ -2021,6 +2071,21 @@ parameters:
count: 1
path: src/webauthn/src/AuthenticatorDataLoader.php

-
message: "#^@readonly property Webauthn\\\\AuthenticatorSelectionCriteria\\:\\:\\$authenticatorAttachment is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/AuthenticatorSelectionCriteria.php

-
message: "#^@readonly property Webauthn\\\\AuthenticatorSelectionCriteria\\:\\:\\$residentKey is assigned outside of the constructor\\.$#"
count: 2
path: src/webauthn/src/AuthenticatorSelectionCriteria.php

-
message: "#^@readonly property Webauthn\\\\AuthenticatorSelectionCriteria\\:\\:\\$userVerification is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/AuthenticatorSelectionCriteria.php

-
message: """
#^Access to deprecated property \\$requireResidentKey of class Webauthn\\\\AuthenticatorSelectionCriteria\\:
Expand All @@ -2039,16 +2104,6 @@ parameters:
count: 1
path: src/webauthn/src/AuthenticatorSelectionCriteria.php

-
message: "#^Class Webauthn\\\\CertificateChainChecker\\\\PhpCertificateChainChecker extends @final class Webauthn\\\\MetadataService\\\\CertificateChain\\\\PhpCertificateChainValidator\\.$#"
count: 1
path: src/webauthn/src/CertificateChainChecker/PhpCertificateChainChecker.php

-
message: "#^Class Webauthn\\\\CertificateToolbox extends @final class Webauthn\\\\MetadataService\\\\CertificateChain\\\\CertificateToolbox\\.$#"
count: 1
path: src/webauthn/src/CertificateToolbox.php

-
message: """
#^Access to deprecated property \\$tokenBinding of class Webauthn\\\\CollectedClientData\\:
Expand All @@ -2058,9 +2113,24 @@ parameters:
path: src/webauthn/src/CollectedClientData.php

-
message: "#^Parameter \\#2 \\$data of class Webauthn\\\\CollectedClientData constructor expects array, mixed given\\.$#"
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$attestation is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/CollectedClientData.php
path: src/webauthn/src/PublicKeyCredentialCreationOptions.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$authenticatorSelection is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialCreationOptions.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$excludeCredentials is assigned outside of the constructor\\.$#"
count: 2
path: src/webauthn/src/PublicKeyCredentialCreationOptions.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:\\$pubKeyCredParams is assigned outside of the constructor\\.$#"
count: 2
path: src/webauthn/src/PublicKeyCredentialCreationOptions.php

-
message: "#^Parameter \\#1 \\$json of static method Webauthn\\\\PublicKeyCredentialCreationOptions\\:\\:createFromArray\\(\\) expects array, mixed given\\.$#"
Expand All @@ -2072,6 +2142,21 @@ parameters:
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptor.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialDescriptorCollection\\:\\:\\$publicKeyCredentialDescriptors is already assigned\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptorCollection.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialDescriptorCollection\\:\\:\\$publicKeyCredentialDescriptors is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Method Webauthn\\\\PublicKeyCredentialDescriptorCollection\\:\\:jsonSerialize\\(\\) should return array\\<array\\<string, mixed\\>\\> but returns array\\<string, Webauthn\\\\PublicKeyCredentialDescriptor\\>\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialDescriptorCollection.php

-
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(array\\)\\: Webauthn\\\\PublicKeyCredentialDescriptor given\\.$#"
count: 1
Expand All @@ -2087,6 +2172,11 @@ parameters:
count: 1
path: src/webauthn/src/PublicKeyCredentialLoader.php

-
message: "#^@readonly property Webauthn\\\\PublicKeyCredentialOptions\\:\\:\\$timeout is assigned outside of the constructor\\.$#"
count: 1
path: src/webauthn/src/PublicKeyCredentialOptions.php

-
message: "#^Cannot access offset string on Webauthn\\\\AuthenticationExtensions\\\\AuthenticationExtensionsClientInputs\\.$#"
count: 2
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
bootstrap="tests/bootstrap.php"
colors="true"
cacheDirectory=".phpunit.cache"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<coverage />
<testsuites>
Expand Down
11 changes: 6 additions & 5 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;

use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector;
use Rector\Doctrine\Set\DoctrineSetList;
Expand All @@ -14,6 +15,7 @@
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector;

return static function (RectorConfig $config): void {
$config->import(SetList::DEAD_CODE);
Expand All @@ -29,19 +31,18 @@
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
$config->import(PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES);
$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_100);
$config->paths([__DIR__ . '/src', __DIR__ . '/tests']);
$config->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']);
$config->skip([
__DIR__ . '/src/symfony/src/DependencyInjection/Configuration.php',
__DIR__ . '/src/symfony/src/Routing/Loader.php',
__DIR__ . '/tests/symfony/config/routing.php',
RemoveUnusedPrivateMethodParameterRector::class => [
__DIR__ . '/src/symfony/src/DependencyInjection/Configuration.php',
],
ReadOnlyPropertyRector::class => [
__DIR__ . '/src/metadata-service/src/Statement/MetadataStatement.php',
],
ReadOnlyPropertyRector::class => [__DIR__ . '/src/metadata-service/src/Statement/MetadataStatement.php'],
PreferPHPUnitThisCallRector::class,
StringToArrayArgumentProcessRector::class => [__DIR__ . '/tests'],
]);
$config->services()->remove(PreferPHPUnitThisCallRector::class);
$config->phpVersion(PhpVersion::PHP_81);
$config->parallel();
$config->importNames();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
use function preg_replace;
use const PHP_EOL;

/**
* @final
*/
class CertificateToolbox
{
private const PEM_HEADER = '-----BEGIN ';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
use const PHP_EOL;
use const PHP_URL_SCHEME;

/**
* @final
*/
class PhpCertificateChainValidator implements CertificateChainValidator, CanDispatchEvents
{
private const MAX_VALIDATION_LENGTH = 5;
Expand Down
8 changes: 1 addition & 7 deletions src/metadata-service/src/Service/MetadataBLOBPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
use function is_int;
use function is_string;

/**
* @final
*/
class MetadataBLOBPayload implements JsonSerializable
{
/**
Expand Down Expand Up @@ -114,10 +111,7 @@ public function jsonSerialize(): array
'legalHeader' => $this->legalHeader,
'nextUpdate' => $this->nextUpdate,
'no' => $this->no,
'entries' => array_map(
static fn (MetadataBLOBPayloadEntry $object): array => $object->jsonSerialize(),
$this->entries
),
'entries' => $this->entries,
];

return Utils::filterNullValues($data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
use function is_array;
use function is_string;

/**
* @final
*/
class MetadataBLOBPayloadEntry implements JsonSerializable
{
/**
Expand Down Expand Up @@ -213,10 +210,7 @@ public function jsonSerialize(): array
'aaid' => $this->aaid,
'aaguid' => $this->aaguid,
'attestationCertificateKeyIdentifiers' => $this->attestationCertificateKeyIdentifiers,
'statusReports' => array_map(
static fn (StatusReport $object): array => $object->jsonSerialize(),
$this->statusReports
),
'statusReports' => $this->statusReports,
'timeOfLastStatusChange' => $this->timeOfLastStatusChange,
'rogueListURL' => $this->rogueListURL,
'rogueListHash' => $this->rogueListHash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use JsonSerializable;

/**
* @final
*/
class AlternativeDescriptions implements JsonSerializable
{
/**
Expand Down
3 changes: 0 additions & 3 deletions src/metadata-service/src/Statement/AuthenticatorGetInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use JsonSerializable;

/**
* @final
*/
class AuthenticatorGetInfo implements JsonSerializable
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use Webauthn\MetadataService\Utils;

/**
* @final
*/
class BiometricAccuracyDescriptor extends AbstractDescriptor
{
public function __construct(
Expand Down
3 changes: 0 additions & 3 deletions src/metadata-service/src/Statement/BiometricStatusReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

use JsonSerializable;

/**
* @final
*/
class BiometricStatusReport implements JsonSerializable
{
private function __construct(
Expand Down
Loading

0 comments on commit 8128dff

Please sign in to comment.