Skip to content

Commit

Permalink
Merge pull request #662 from emteknetnz/php84-implicit-nullable
Browse files Browse the repository at this point in the history
Make nullable parameters explicity nullable for PHP 8.4
  • Loading branch information
Spomky authored Jan 3, 2025
2 parents 47b20e6 + b7265fd commit 3cd37d3
Show file tree
Hide file tree
Showing 23 changed files with 40 additions and 40 deletions.
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 @@ -17,7 +17,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 @@ -33,7 +33,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 in_array(
$type,
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 @@ -19,7 +19,7 @@ class ExtensionDescriptorDenormalizer implements DenormalizerInterface, Denormal

private const ALREADY_CALLED = 'EXTENSION_DESCRIPTOR_PREPROCESS_ALREADY_CALLED';

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 @@ -31,7 +31,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $this->denormalizer->denormalize($data, $type, $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
{
if ($context[self::ALREADY_CALLED] ?? false) {
return false;
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 @@ -36,7 +36,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 @@ -29,7 +29,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 === 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 @@ -16,7 +16,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('ecdaaKeyId', $data) => new EcdaaKeyIdTrustPath($data),
Expand All @@ -26,7 +26,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
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

0 comments on commit 3cd37d3

Please sign in to comment.