From fd8af8f7042a0b8b0f6b2cb6d9706d54ffb7671e Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 12 Jul 2024 16:35:35 +0200 Subject: [PATCH] Refactor variable name in PublicKeyCredentialOptionsDenormalizer The variable name "data" has been renamed to "object" in the normalize function of PublicKeyCredentialOptionsDenormalizer. The replacement aligns better to represent the instances of PublicKeyCredentialCreationOptions or PublicKeyCredentialRequestOptions that are passed into the function. --- ...PublicKeyCredentialOptionsDenormalizer.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/webauthn/src/Denormalizer/PublicKeyCredentialOptionsDenormalizer.php b/src/webauthn/src/Denormalizer/PublicKeyCredentialOptionsDenormalizer.php index 33d229e6..7a1c207a 100644 --- a/src/webauthn/src/Denormalizer/PublicKeyCredentialOptionsDenormalizer.php +++ b/src/webauthn/src/Denormalizer/PublicKeyCredentialOptionsDenormalizer.php @@ -131,46 +131,46 @@ public function getSupportedTypes(?string $format): array /** * @return array */ - public function normalize(mixed $data, ?string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { assert( - $data instanceof PublicKeyCredentialCreationOptions || $data instanceof PublicKeyCredentialRequestOptions + $object instanceof PublicKeyCredentialCreationOptions || $object instanceof PublicKeyCredentialRequestOptions ); $json = [ - 'challenge' => Base64UrlSafe::encodeUnpadded($data->challenge), - 'timeout' => $data->timeout, - 'extensions' => $data->extensions->count() === 0 ? null : $this->normalizer->normalize( - $data->extensions, + 'challenge' => Base64UrlSafe::encodeUnpadded($object->challenge), + 'timeout' => $object->timeout, + 'extensions' => $object->extensions->count() === 0 ? null : $this->normalizer->normalize( + $object->extensions, $format, $context ), ]; - if ($data instanceof PublicKeyCredentialCreationOptions) { + if ($object instanceof PublicKeyCredentialCreationOptions) { $json = [ ...$json, - 'rp' => $this->normalizer->normalize($data->rp, $format, $context), - 'user' => $this->normalizer->normalize($data->user, $format, $context), + 'rp' => $this->normalizer->normalize($object->rp, $format, $context), + 'user' => $this->normalizer->normalize($object->user, $format, $context), 'pubKeyCredParams' => $this->normalizer->normalize( - $data->pubKeyCredParams, + $object->pubKeyCredParams, PublicKeyCredentialParameters::class . '[]', $context ), - 'authenticatorSelection' => $data->authenticatorSelection === null ? null : $this->normalizer->normalize( - $data->authenticatorSelection, + 'authenticatorSelection' => $object->authenticatorSelection === null ? null : $this->normalizer->normalize( + $object->authenticatorSelection, $format, $context ), - 'attestation' => $data->attestation, - 'excludeCredentials' => $this->normalizer->normalize($data->excludeCredentials, $format, $context), + 'attestation' => $object->attestation, + 'excludeCredentials' => $this->normalizer->normalize($object->excludeCredentials, $format, $context), ]; } - if ($data instanceof PublicKeyCredentialRequestOptions) { + if ($object instanceof PublicKeyCredentialRequestOptions) { $json = [ ...$json, - 'rpId' => $data->rpId, - 'allowCredentials' => $this->normalizer->normalize($data->allowCredentials, $format, $context), - 'userVerification' => $data->userVerification, + 'rpId' => $object->rpId, + 'allowCredentials' => $this->normalizer->normalize($object->allowCredentials, $format, $context), + 'userVerification' => $object->userVerification, ]; }