From b743475761b2453b161492a69b4cbd8dd8cba220 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 21 Dec 2021 11:58:58 +0100 Subject: [PATCH] sa: Fix all issues related to PHP versions and static-analysis. --- phpstan-deprecations.neon | 18 ------------------ .../Serializer/Encoder/DocGenEncoder.php | 7 ++++--- .../Normalizer/CollectionDocGenNormalizer.php | 4 ++-- .../Normalizer/DocGenObjectNormalizer.php | 4 ++-- .../Normalizer/AddressNormalizer.php | 4 ++-- .../Serializer/Normalizer/CenterNormalizer.php | 8 ++++---- .../Normalizer/CollectionNormalizer.php | 4 ++-- .../Serializer/Normalizer/DateNormalizer.php | 8 ++++---- .../DiscriminatedObjectDenormalizer.php | 4 ++-- .../DoctrineExistingEntityNormalizer.php | 4 ++-- .../Serializer/Normalizer/PointNormalizer.php | 4 ++-- .../Serializer/Normalizer/UserNormalizer.php | 4 ++-- .../AccompanyingCourseCommentController.php | 12 +++++++++--- .../AccompanyingPeriodDocGenNormalizer.php | 10 ++++++---- .../AccompanyingPeriodOriginNormalizer.php | 9 ++++++--- ...companyingPeriodParticipationNormalizer.php | 11 +++++++---- .../AccompanyingPeriodResourceNormalizer.php | 4 ++-- .../AccompanyingPeriodWorkDenormalizer.php | 4 ++-- .../Normalizer/MembersEditorNormalizer.php | 4 ++-- .../Normalizer/PersonDocGenNormalizer.php | 4 ++-- .../Normalizer/PersonJsonNormalizer.php | 13 +++++++------ .../RelationshipDocGenNormalizer.php | 4 ++-- .../Normalizer/SocialActionNormalizer.php | 4 ++-- .../Normalizer/SocialIssueNormalizer.php | 4 ++-- .../Normalizer/ThirdPartyNormalizer.php | 4 ++-- 25 files changed, 79 insertions(+), 81 deletions(-) diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index 05442b25a..24deda05f 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -417,15 +417,6 @@ parameters: count: 1 path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php - - - message: - """ - #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 3 - path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php - - message: """ @@ -435,15 +426,6 @@ parameters: count: 1 path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php - - - message: - """ - #^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\: - since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$# - """ - count: 1 - path: src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php - - message: """ diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php index ee63c13d6..e3e7b68a9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Encoder/DocGenEncoder.php @@ -15,10 +15,11 @@ use Symfony\Component\Serializer\Exception\UnexpectedValueException; use function array_keys; use function is_array; +use Symfony\Component\Serializer\Encoder\EncoderInterface; -class DocGenEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInterface +class DocGenEncoder implements EncoderInterface { - public function encode($data, string $format, array $context = []) + public function encode($data, $format, array $context = []) { if (!$this->isAssociative($data)) { throw new UnexpectedValueException('Only associative arrays are allowed; lists are not allowed'); @@ -30,7 +31,7 @@ class DocGenEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInte return $result; } - public function supportsEncoding(string $format) + public function supportsEncoding($format) { return 'docgen' === $format; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/CollectionDocGenNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/CollectionDocGenNormalizer.php index 35c683138..49bef0270 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/CollectionDocGenNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/CollectionDocGenNormalizer.php @@ -29,7 +29,7 @@ class CollectionDocGenNormalizer implements ContextAwareNormalizerInterface, Nor * * @return array|ArrayObject|bool|float|int|string|void|null */ - public function normalize($object, ?string $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []) { $data = []; @@ -44,7 +44,7 @@ class CollectionDocGenNormalizer implements ContextAwareNormalizerInterface, Nor return $data; } - public function supportsNormalization($data, ?string $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []) { if ('docgen' !== $format) { return false; diff --git a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php index d9d42afdf..fc4b4beb9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php +++ b/src/Bundle/ChillDocGeneratorBundle/Serializer/Normalizer/DocGenObjectNormalizer.php @@ -55,7 +55,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte $this->translatableStringHelper = $translatableStringHelper; } - public function normalize($object, ?string $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []) { $classMetadataKey = $object ?? $context['docgen:expects'] ?? null; @@ -96,7 +96,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte return $this->normalizeObject($object, $format, $context, $expectedGroups, $metadata, $attributes); } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { return 'docgen' === $format && (is_object($data) || null === $data); } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index fd250e967..c33f3ce89 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -49,7 +49,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw /** * @param Address $address */ - public function normalize($address, ?string $format = null, array $context = []) + public function normalize($address, $format = null, array $context = []) { if ($address instanceof Address) { $text = $address->isNoAddress() ? '' : $address->getStreet() . ', ' . $address->getStreetNumber(); @@ -118,7 +118,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw throw new UnexpectedValueException(); } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { if ('json' === $format) { return $data instanceof Address; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index 76bc15afc..c4d7fa871 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -29,7 +29,7 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface $this->repository = $repository; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { if (false === array_key_exists('type', $data)) { throw new InvalidArgumentException('missing "type" key in data'); @@ -52,7 +52,7 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface return $center; } - public function normalize($center, ?string $format = null, array $context = []) + public function normalize($center, $format = null, array $context = []) { /** @var Center $center */ return [ @@ -62,12 +62,12 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface ]; } - public function supportsDenormalization($data, string $type, ?string $format = null) + public function supportsDenormalization($data, $type, $format = null) { return Center::class === $type; } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { return $data instanceof Center && 'json' === $format; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php index 0c80e0439..b9139cf54 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php @@ -23,7 +23,7 @@ class CollectionNormalizer implements NormalizerAwareInterface, NormalizerInterf /** * @param Collection $collection */ - public function normalize($collection, ?string $format = null, array $context = []) + public function normalize($collection, $format = null, array $context = []) { $paginator = $collection->getPaginator(); @@ -40,7 +40,7 @@ class CollectionNormalizer implements NormalizerAwareInterface, NormalizerInterf ]; } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { return $data instanceof Collection; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index acf9fe369..70958d5a9 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -36,7 +36,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt $this->parameterBag = $parameterBag; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { if (null === $data) { return null; @@ -54,7 +54,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt throw new UnexpectedValueException(); } - public function normalize($date, ?string $format = null, array $context = []) + public function normalize($date, $format = null, array $context = []) { /** @var DateTimeInterface $date */ switch ($format) { @@ -91,7 +91,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt } } - public function supportsDenormalization($data, string $type, ?string $format = null): bool + public function supportsDenormalization($data, $type, $format = null): bool { return DateTimeInterface::class === $type || DateTime::class === $type @@ -99,7 +99,7 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt || (is_array($data) && array_key_exists('datetime', $data)); } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { if ('json' === $format) { return $data instanceof DateTimeInterface; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php index 7a1ff12e9..77f14c8da 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php @@ -38,7 +38,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa */ public const TYPE = '@multi'; - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { foreach ($context[self::ALLOWED_TYPES] as $localType) { if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) { @@ -54,7 +54,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa 'ALLOWED_TYPES: %s', implode(', ', $context[self::ALLOWED_TYPES]))); } - public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []) + public function supportsDenormalization($data, $type, $format = null, array $context = []) { if (self::TYPE !== $type) { return false; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index edbcfb2a9..1cf94ac9f 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -33,7 +33,7 @@ class DoctrineExistingEntityNormalizer implements DenormalizerInterface $this->serializerMetadataFactory = $serializerMetadataFactory; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { if (array_key_exists(AbstractNormalizer::OBJECT_TO_POPULATE, $context)) { return $context[AbstractNormalizer::OBJECT_TO_POPULATE]; @@ -43,7 +43,7 @@ class DoctrineExistingEntityNormalizer implements DenormalizerInterface ->find($data['id']); } - public function supportsDenormalization($data, string $type, ?string $format = null) + public function supportsDenormalization($data, $type, $format = null) { if (false === is_array($data)) { return false; diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php index 81ec4e500..479cc6864 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php @@ -20,7 +20,7 @@ use function is_array; class PointNormalizer implements DenormalizerInterface { - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { if (!is_array($data)) { throw new InvalidArgumentException('point data is not an array. It should be an array of 2 coordinates.'); @@ -33,7 +33,7 @@ class PointNormalizer implements DenormalizerInterface return Point::fromLonLat($data[0], $data[1]); } - public function supportsDenormalization($data, string $type, ?string $format = null): bool + public function supportsDenormalization($data, $type, $format = null): bool { return Point::class === $type; } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index d8c616d82..082491bd0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -40,7 +40,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware $this->userRender = $userRender; } - public function normalize($user, ?string $format = null, array $context = []) + public function normalize($user, $format = null, array $context = []) { /** @var User $user */ $userJobContext = array_merge( @@ -77,7 +77,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware ]; } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { if ($data instanceof User && ('json' === $format || 'docgen' === $format)) { return true; diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php index cd103fd99..f73db6a28 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseCommentController.php @@ -19,6 +19,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; use function array_key_exists; @@ -37,6 +38,7 @@ class AccompanyingCourseCommentController extends AbstractController $newComment->setAccompanyingPeriod($accompanyingCourse); $form = $this->createCommentForm($newComment, 'new'); + $editForm = null; if ($request->query->has('edit')) { foreach ($accompanyingCourse->getComments() as $comment) { @@ -53,12 +55,16 @@ class AccompanyingCourseCommentController extends AbstractController } } + if (null === $editForm) { + throw new NotFoundHttpException('Unable to find an edit form.'); + } + if ($request->getMethod() === Request::METHOD_POST) { + $currentForm = $editForm->handleRequest($request); + if (array_key_exists('edit', $request->request->all()[$editForm->getName()])) { - $currentForm = $editForm->handleRequest($request); $isEditingNew = false; } else { - $currentForm = $form->handleRequest($request); $isEditingNew = true; } @@ -79,7 +85,7 @@ class AccompanyingCourseCommentController extends AbstractController return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, 'form' => $form->createView(), - 'edit_form' => isset($editForm) ? $editForm->createView() : null, + 'edit_form' => $editForm !== null ? $editForm->createView() : null, 'commentEditId' => $commentEditId ?? null, ]); } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index 93c9c075d..521c24c29 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -94,7 +94,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf /** * @param AccompanyingPeriod|null $period */ - public function normalize($period, ?string $format = null, array $context = []) + public function normalize($period, $format = null, array $context = []) { if ($period instanceof AccompanyingPeriod) { $scopes = $this->scopeResolverDispatcher->isConcerned($period) ? $this->scopeResolverDispatcher->resolveScope($period) : []; @@ -147,7 +147,9 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'hasRequestor' => $period->getRequestor() !== null, 'requestorKind' => $period->getRequestorKind(), ]; - } elseif (null === $period) { + } + + if (null === $period) { return array_merge( (new NormalizeNullValueHelper($this->normalizer, 'type', 'accompanying_period')) ->normalize(self::PERIOD_NULL, $format, $context), @@ -163,10 +165,10 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf ); } - throw new InvalidArgumentException('this neither an accompanying period or null'); + throw new InvalidArgumentException('This neither an accompanying period or null.'); } - public function supportsNormalization($data, ?string $format = null, array $context = []): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { if ('docgen' !== $format) { return false; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php index 5c05d111e..7ee2a53c8 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php @@ -19,9 +19,12 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; */ final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface { - public function normalize($origin, ?string $format = null, array $context = []) + + /** + * @param Origin $origin + */ + public function normalize($origin, $format = null, array $context = []) { - /** @var Origin $origin */ return [ 'type' => 'origin', 'id' => $origin->getId(), @@ -30,7 +33,7 @@ final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface ]; } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { return $data instanceof Origin; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php index b4110a8ae..dda79dbdf 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php @@ -17,11 +17,13 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterface, NormalizerInterface { - protected ?NormalizerInterface $normalizer = null; + private ?NormalizerInterface $normalizer = null; - public function normalize($participation, ?string $format = null, array $context = []) + /** + * @param AccompanyingPeriodParticipation $participation + */ + public function normalize($participation, $format = null, array $context = []) { - /** @var AccompanyingPeriodParticipation $participation */ return [ 'id' => $participation->getId(), 'startDate' => $this->normalizer->normalize($participation->getStartDate(), $format), @@ -35,8 +37,9 @@ class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterf $this->normalizer = $normalizer; } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { + // @TODO Fix this. return false; return $data instanceof AccompanyingPeriodParticipation; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index c9db6b07c..cb883542a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -38,7 +38,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface $this->repository = $repository; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { $resource = $this->extractObjectToPopulate($type, $context); @@ -87,7 +87,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface return $resource; } - public function supportsDenormalization($data, string $type, ?string $format = null) + public function supportsDenormalization($data, $type, $format = null) { return Resource::class === $type; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php index d36d97389..edbe07e47 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php @@ -51,7 +51,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte $this->em = $em; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { $work = $this->denormalizer->denormalize($data, $type, $format, array_merge( $context, @@ -65,7 +65,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte return $work; } - public function supportsDenormalization($data, string $type, ?string $format = null, array $context = []): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return AccompanyingPeriodWork::class === $type && self::class !== ($context['skip'] ?? null) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index 36aa59567..e2fb0f7dc 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -35,7 +35,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize $this->factory = $factory; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { // some test about schema first... $this->performChecks($data); @@ -50,7 +50,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize return $this->denormalizeMove($data, $type, $format, $context); } - public function supportsDenormalization($data, string $type, ?string $format = null) + public function supportsDenormalization($data, $type, $format = null) { return MembersEditor::class === $type; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index f82dc91b8..7a728774b 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -57,7 +57,7 @@ class PersonDocGenNormalizer implements $this->translatableStringHelper = $translatableStringHelper; } - public function normalize($person, ?string $format = null, array $context = []) + public function normalize($person, $format = null, array $context = []) { /** @var Person $person */ $dateContext = $context; @@ -132,7 +132,7 @@ class PersonDocGenNormalizer implements return $data; } - public function supportsNormalization($data, ?string $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []) { if ('docgen' !== $format) { return false; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 98e157712..13dfc32e3 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -59,7 +59,7 @@ class PersonJsonNormalizer implements $this->centerResolverManager = $centerResolverManager; } - public function denormalize($data, string $type, ?string $format = null, array $context = []) + public function denormalize($data, $type, $format = null, array $context = []) { $person = $this->extractObjectToPopulate($type, $context); @@ -140,12 +140,13 @@ class PersonJsonNormalizer implements return $person; } - public function normalize($person, ?string $format = null, array $context = []) + /** + * @param Person $person + */ + public function normalize($person, $format = null, array $context = []) { - /** @var Household $household */ $household = $person->getCurrentHousehold(); - /** @var Person $person */ return [ 'type' => 'person', 'id' => $person->getId(), @@ -164,12 +165,12 @@ class PersonJsonNormalizer implements ]; } - public function supportsDenormalization($data, string $type, ?string $format = null) + public function supportsDenormalization($data, $type, $format = null) { return Person::class === $type && 'person' === ($data['type'] ?? null); } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, $format = null): bool { return $data instanceof Person && 'json' === $format; } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php index 7d90e40e2..92eacfac3 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php @@ -32,7 +32,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N /** * @param Relationship $relation */ - public function normalize($relation, ?string $format = null, array $context = []) + public function normalize($relation, $format = null, array $context = []) { $counterpart = $context['docgen:relationship:counterpart'] ?? null; $contextPerson = array_merge($context, [ @@ -78,7 +78,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N ]; } - public function supportsNormalization($data, ?string $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []) { if ('docgen' !== $format) { return false; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php index e085f0224..e971c793a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php @@ -28,7 +28,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte $this->render = $render; } - public function normalize($socialAction, ?string $format = null, array $context = []) + public function normalize($socialAction, $format = null, array $context = []) { switch ($format) { case 'json': @@ -58,7 +58,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte } } - public function supportsNormalization($data, ?string $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []) { if ($data instanceof SocialAction && 'json' === $format) { return true; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php index 21341659c..0e5fb3730 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php @@ -28,7 +28,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz $this->render = $render; } - public function normalize($socialIssue, ?string $format = null, array $context = []) + public function normalize($socialIssue, $format = null, array $context = []) { /** @var SocialIssue $socialIssue */ switch ($format) { @@ -57,7 +57,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz } } - public function supportsNormalization($data, ?string $format = null, array $context = []) + public function supportsNormalization($data, $format = null, array $context = []) { if ($data instanceof SocialIssue && 'json' === $format) { return true; diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index 91592ffde..2c47df6c7 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -31,7 +31,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf /** * @param ThirdParty $thirdParty */ - public function normalize($thirdParty, ?string $format = null, array $context = []) + public function normalize($thirdParty, $format = null, array $context = []) { return [ 'type' => 'thirdparty', @@ -49,7 +49,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf ]; } - public function supportsNormalization($data, ?string $format = null) + public function supportsNormalization($data, $format = null) { return $data instanceof ThirdParty && 'json' === $format; }