Skip to content

Commit

Permalink
minor #216 allow int enum to be normalized as int (maximecolin)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x-dev branch.

Discussion
----------

allow int enum to be normalized as int

Commits
-------

1615515 allow int enum to be normalized as int
  • Loading branch information
ogizanagi committed Feb 20, 2023
2 parents 7266715 + 1615515 commit f4a08aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Bridge/Symfony/Serializer/Normalizer/EnumNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ class EnumNormalizer implements NormalizerInterface, DenormalizerInterface
/**
* {@inheritdoc}
*
* @param EnumInterface $object
* @template T of int|string
* @param EnumInterface<T> $object
*
* @return T
*/
public function normalize($object, $format = null, array $context = []): string
public function normalize($object, $format = null, array $context = [])
{
return $object->getValue();
}
Expand Down

0 comments on commit f4a08aa

Please sign in to comment.