Skip to content

Commit c75a1ab

Browse files
committed
Fix GreetingInputDenormalizer::getSupportedTypes
`Error: Class App\Rest\Serializer\GreetingInputDenormalizer contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Symfony\Component\Serializer\Normalizer\DenormalizerInterface::getSupportedTypes)`
1 parent a64de31 commit c75a1ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

code_samples/api/rest_api/src/Rest/Serializer/GreetingInputDenormalizer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ public function supportsDenormalization(mixed $data, string $type, ?string $form
3535
}
3636
$data = array_change_key_case($data);
3737

38-
return Greeting::class === $type &&
38+
return in_array($type, $this->getSupportedTypes($format), true) &&
3939
(array_key_exists('salutation', $data) || array_key_exists('recipient', $data));
4040
}
41+
42+
public function getSupportedTypes(?string $format): array
43+
{
44+
return [
45+
Greeting::class => true,
46+
];
47+
}
4148
}

0 commit comments

Comments
 (0)