Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a90e4c

Browse files
minor #47298 Add missing types to BackedEnumNormalizer (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- Add missing types to BackedEnumNormalizer | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Spotted while reviewing #47296 Not sure why we missed adding them in #40830 🤷 Commits ------- 60d6325 [Serializer] Add missing types to BackedEnumNormalizer
2 parents c77a645 + 60d6325 commit 3a90e4c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class BackedEnumNormalizer implements NormalizerInterface, DenormalizerInt
2929
*
3030
* @return int|string
3131
*/
32-
public function normalize($object, $format = null, array $context = [])
32+
public function normalize($object, string $format = null, array $context = [])
3333
{
3434
if (!$object instanceof \BackedEnum) {
3535
throw new InvalidArgumentException('The data must belong to a backed enumeration.');
@@ -41,7 +41,7 @@ public function normalize($object, $format = null, array $context = [])
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function supportsNormalization($data, $format = null): bool
44+
public function supportsNormalization($data, string $format = null): bool
4545
{
4646
return $data instanceof \BackedEnum;
4747
}
@@ -51,7 +51,7 @@ public function supportsNormalization($data, $format = null): bool
5151
*
5252
* @throws NotNormalizableValueException
5353
*/
54-
public function denormalize($data, $type, $format = null, array $context = [])
54+
public function denormalize($data, string $type, string $format = null, array $context = [])
5555
{
5656
if (!is_subclass_of($type, \BackedEnum::class)) {
5757
throw new InvalidArgumentException('The data must belong to a backed enumeration.');
@@ -71,7 +71,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
7171
/**
7272
* {@inheritdoc}
7373
*/
74-
public function supportsDenormalization($data, $type, $format = null): bool
74+
public function supportsDenormalization($data, string $type, string $format = null): bool
7575
{
7676
return is_subclass_of($type, \BackedEnum::class);
7777
}

0 commit comments

Comments
 (0)