Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix php 8.4 deprecations #661

Open
wants to merge 2 commits into
base: 5.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies:
- "lowest"
- "highest"
Expand Down
2 changes: 1 addition & 1 deletion src/symfony/src/Exception/HttpNotImplementedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class HttpNotImplementedException extends HttpException
/**
* @param array<string, mixed> $headers
*/
public function __construct(string $message = '', Throwable $previous = null, int $code = 0, array $headers = [])
public function __construct(string $message = '', ?Throwable $previous = null, int $code = 0, array $headers = [])
{
parent::__construct(501, $message, $previous, $headers, $code);
}
Expand Down
4 changes: 2 additions & 2 deletions src/symfony/src/Routing/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public function add(string $pattern, ?string $host, string $name, string $method
/**
* @noRector
*/
public function load(mixed $resource, string $type = null): RouteCollection
public function load(mixed $resource, ?string $type = null): RouteCollection
{
return $this->routes;
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return $type === 'webauthn';
}
Expand Down
2 changes: 1 addition & 1 deletion src/symfony/src/Security/Handler/DefaultFailureHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

final class DefaultFailureHandler implements FailureHandler, AuthenticationFailureHandlerInterface
{
public function onFailure(Request $request, Throwable $exception = null): Response
public function onFailure(Request $request, ?Throwable $exception = null): Response
{
$data = [
'status' => 'error',
Expand Down
2 changes: 1 addition & 1 deletion src/symfony/src/Security/Handler/FailureHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

interface FailureHandler
{
public function onFailure(Request $request, Throwable $exception = null): Response;
public function onFailure(Request $request, ?Throwable $exception = null): Response;
}
2 changes: 1 addition & 1 deletion src/symfony/src/Service/DefaultFailureHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

final class DefaultFailureHandler implements FailureHandler
{
public function onFailure(Request $request, Throwable $exception = null): Response
public function onFailure(Request $request, ?Throwable $exception = null): Response
{
$data = [
'status' => 'error',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct(
public readonly AuthenticationExtension $authenticationExtension,
string $message = '',
int $code = 0,
Throwable $previous = null
?Throwable $previous = null
) {
parent::__construct($message, $code, $previous);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class AttestationObjectDenormalizer implements DenormalizerInterface, Deno
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$stream = new StringStream($data);
$parsed = Decoder::create()->decode($stream);
Expand All @@ -46,7 +46,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AttestationObject::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public function __construct(
) {
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$attestationStatementSupport = $this->attestationStatementSupportManager->get($data['fmt']);

return $attestationStatementSupport->load($data);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AttestationStatement::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class AuthenticationExtensionsDenormalizer implements DenormalizerInterface, NormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if ($data instanceof AuthenticationExtensions) {
return AuthenticationExtensions::create($data->extensions);
Expand All @@ -30,7 +30,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return AuthenticationExtensions::create($data);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AuthenticationExtensions::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class AuthenticatorAssertionResponseDenormalizer implements DenormalizerIn
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$data['authenticatorData'] = Base64::decode($data['authenticatorData']);
$data['signature'] = Base64::decode($data['signature']);
Expand All @@ -42,7 +42,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AuthenticatorAssertionResponse::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class AuthenticatorAttestationResponseDenormalizer implements Denormalizer
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$data['clientDataJSON'] = Base64UrlSafe::decodeNoPadding($data['clientDataJSON']);
$data['attestationObject'] = Base64::decode($data['attestationObject']);
Expand All @@ -42,7 +42,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AuthenticatorAttestationResponse::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct()
$this->decoder = Decoder::create();
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$authData = $this->fixIncorrectEdDSAKey($data);
$authDataStream = new StringStream($authData);
Expand Down Expand Up @@ -87,7 +87,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AuthenticatorData::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class AuthenticatorResponseDenormalizer implements DenormalizerInterface,
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$realType = match (true) {
array_key_exists('attestationObject', $data) => AuthenticatorAttestationResponse::class,
Expand All @@ -28,7 +28,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $this->denormalizer->denormalize($data, $realType, $format, $context);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === AuthenticatorResponse::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ final class CollectedClientDataDenormalizer implements DenormalizerInterface, De
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
return CollectedClientData::create($data, json_decode($data, true, flags: JSON_THROW_ON_ERROR));
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === CollectedClientData::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class ExtensionDescriptorDenormalizer implements DenormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (array_key_exists('fail_if_unknown', $data)) {
$data['failIfUnknown'] = $data['fail_if_unknown'];
Expand All @@ -20,7 +20,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return ExtensionDescriptor::create(...$data);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === ExtensionDescriptor::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class PublicKeyCredentialDenormalizer implements DenormalizerInterface, De
{
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (! array_key_exists('id', $data)) {
return $data;
Expand All @@ -35,7 +35,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === PublicKeyCredential::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class PublicKeyCredentialOptionsDenormalizer implements DenormalizerInterf
use DenormalizerAwareTrait;
use NormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (array_key_exists('challenge', $data)) {
$data['challenge'] = Base64UrlSafe::decodeNoPadding($data['challenge']);
Expand Down Expand Up @@ -103,7 +103,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
throw new BadMethodCallException('Unsupported type');
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return in_array(
$type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class PublicKeyCredentialParametersDenormalizer implements DenormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (! array_key_exists('type', $data) || ! array_key_exists('alg', $data)) {
throw new InvalidDataException($data, 'Missing type or alg');
Expand All @@ -20,7 +20,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return PublicKeyCredentialParameters::create($data['type'], $data['alg']);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === PublicKeyCredentialParameters::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class PublicKeyCredentialSourceDenormalizer implements DenormalizerInterfa
use NormalizerAwareTrait;
use DenormalizerAwareTrait;

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
$keys = ['publicKeyCredentialId', 'credentialPublicKey', 'userHandle'];
foreach ($keys as $key) {
Expand All @@ -49,7 +49,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === PublicKeyCredentialSource::class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class PublicKeyCredentialUserEntityDenormalizer implements DenormalizerInterface, NormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (! array_key_exists('id', $data)) {
return $data;
Expand All @@ -24,7 +24,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return PublicKeyCredentialUserEntity::create($data['name'], $data['id'], $data['displayName']);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === PublicKeyCredentialUserEntity::class;
}
Expand Down
4 changes: 2 additions & 2 deletions src/webauthn/src/Denormalizer/TrustPathDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final class TrustPathDenormalizer implements DenormalizerInterface, NormalizerInterface
{
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
return match (true) {
array_key_exists('x5c', $data) => CertificateTrustPath::create($data),
Expand All @@ -24,7 +24,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
};
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
{
return $type === TrustPath::class;
}
Expand Down
4 changes: 2 additions & 2 deletions src/webauthn/src/MetadataService/Psr18HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function request(string $method, string $url, array $options = []): Respo
/**
* @param ResponseInterface|iterable<array-key, ResponseInterface> $responses
*/
public function stream(iterable|ResponseInterface $responses, float $timeout = null): ResponseStreamInterface
public function stream(iterable|ResponseInterface $responses, ?float $timeout = null): ResponseStreamInterface
{
throw new LogicException('Not implemented');
}
Expand Down Expand Up @@ -119,7 +119,7 @@ public function cancel(): void
// noop
}

public function getInfo(string $type = null): mixed
public function getInfo(?string $type = null): mixed
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
private readonly array $additionalHeaderParameters = [],
private readonly ?CertificateChainValidator $certificateChainValidator = null,
private readonly ?string $rootCertificateUri = null,
SerializerInterface $serializer = null,
?SerializerInterface $serializer = null,
) {
$this->serializer = $serializer ?? (new WebauthnSerializerFactory(
AttestationStatementSupportManager::create()
Expand Down
2 changes: 1 addition & 1 deletion tests/symfony/functional/FailureHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
return $this->onFailure($request, $exception);
}

public function onFailure(Request $request, Throwable $exception = null): Response
public function onFailure(Request $request, ?Throwable $exception = null): Response
{
$data = [
'status' => 'error',
Expand Down
Loading