Fix implicit variable creation.

This commit is contained in:
Pol Dellaiera
2021-11-09 15:25:45 +01:00
parent a1b381a3ea
commit 5e5dcaefe7
21 changed files with 464 additions and 581 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Chill\ThirdPartyBundle\Serializer\Normalizer;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
@@ -20,23 +22,24 @@ class ThirdPartyNormalizer implements NormalizerInterface, NormalizerAwareInterf
$this->thirdPartyRender = $thirdPartyRender;
}
/**
* @param ThirdParty $thirdParty
*/
public function normalize($thirdParty, string $format = null, array $context = [])
{
/** @var $thirdParty ThirdParty */
$data['type'] = 'thirdparty';
$data['text'] = $this->thirdPartyRender->renderString($thirdParty, []);
$data['id'] = $thirdParty->getId();
$data['kind'] = $thirdParty->getKind();
$data['address'] = $this->normalizer->normalize($thirdParty->getAddress(), $format,
[ 'address_rendering' => 'short' ]);
$data['phonenumber'] = $thirdParty->getTelephone();
$data['email'] = $thirdParty->getEmail();
$data['isChild'] = $thirdParty->isChild();
$data['parent'] = $this->normalizer->normalize($thirdParty->getParent(), $format, $context);
$data['civility'] = $this->normalizer->normalize($thirdParty->getCivility(), $format, $context);
$data['contactDataAnonymous'] = $thirdParty->isContactDataAnonymous();
return $data;
return [
'type' => 'thirdparty',
'text' => $this->thirdPartyRender->renderString($thirdParty, []),
'id' => $thirdParty->getId(),
'kind' => $thirdParty->getKind(),
'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, [ 'address_rendering' => 'short' ]),
'phonenumber' => $thirdParty->getTelephone(),
'email' => $thirdParty->getEmail(),
'isChild' => $thirdParty->isChild(),
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
];
}
public function supportsNormalization($data, string $format = null)