DX: fix contravariant type-hinting on ThirdPartyNormalizer

This commit is contained in:
2023-03-28 23:01:00 +02:00
parent e935bc20aa
commit 2a303c7ba4
2 changed files with 5 additions and 14 deletions

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -35,12 +36,12 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
$this->translatableStringHelper = $translatableStringHelper;
}
/**
* @param ThirdParty $thirdParty
* @param string|null $format
*/
public function normalize($thirdParty, $format = null, array $context = [])
{
if (!$thirdParty instanceof ThirdParty) {
throw new UnexpectedValueException();
}
return [
'type' => 'thirdparty',
'firstname' => $thirdParty->getFirstname(),