Skip to content

Add missing types to BackedEnumNormalizer #47298

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

Merged
merged 1 commit into from
Aug 17, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class BackedEnumNormalizer implements NormalizerInterface, DenormalizerInt
*
* @return int|string
*/
public function normalize($object, $format = null, array $context = [])
public function normalize($object, string $format = null, array $context = [])
{
if (!$object instanceof \BackedEnum) {
throw new InvalidArgumentException('The data must belong to a backed enumeration.');
Expand All @@ -41,7 +41,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null): bool
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof \BackedEnum;
}
Expand All @@ -51,7 +51,7 @@ public function supportsNormalization($data, $format = null): bool
*
* @throws NotNormalizableValueException
*/
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, string $type, string $format = null, array $context = [])
{
if (!is_subclass_of($type, \BackedEnum::class)) {
throw new InvalidArgumentException('The data must belong to a backed enumeration.');
Expand All @@ -71,7 +71,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null): bool
public function supportsDenormalization($data, string $type, string $format = null): bool
{
return is_subclass_of($type, \BackedEnum::class);
}
Expand Down