Rector changes and immplementations of required methods

This commit is contained in:
2025-05-22 17:47:07 +02:00
parent 053b92b77c
commit 17db59d221
1138 changed files with 2656 additions and 2616 deletions

View File

@@ -33,7 +33,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class AccompanyingPeriodDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;
@@ -78,7 +78,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
* @param AccompanyingPeriod|null $period
* @param string|null $format
*/
public function normalize($period, $format = null, array $context = [])
public function normalize($period, $format = null, array $context = []): array
{
if ($period instanceof AccompanyingPeriod) {
$scopes = $this->scopeResolverDispatcher->isConcerned($period) ? $this->scopeResolverDispatcher->resolveScope($period) : [];

View File

@@ -23,7 +23,7 @@ final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface
* @param Origin $origin
* @param string|null $format
*/
public function normalize($origin, $format = null, array $context = [])
public function normalize($origin, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
return [
'type' => 'origin',
@@ -33,8 +33,19 @@ final class AccompanyingPeriodOriginNormalizer implements NormalizerInterface
];
}
public function supportsNormalization($data, $format = null): bool
public function supportsNormalization($data, $format = null, array $context = []): bool
{
return $data instanceof Origin && 'json' === $format;
}
public function getSupportedTypes(?string $format): array
{
if ('json' !== $format) {
return [];
}
return [
Origin::class => true,
];
}
}

View File

@@ -23,7 +23,7 @@ class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterf
* @param AccompanyingPeriodParticipation $participation
* @param string|null $format
*/
public function normalize($participation, $format = null, array $context = [])
public function normalize($participation, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
return [
'id' => $participation->getId(),
@@ -33,12 +33,12 @@ class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterf
];
}
public function setNormalizer(NormalizerInterface $normalizer)
public function setNormalizer(NormalizerInterface $normalizer): void
{
$this->normalizer = $normalizer;
}
public function supportsNormalization($data, $format = null): bool
public function supportsNormalization($data, $format = null, array $context = []): bool
{
// @TODO Fix this.
return false;

View File

@@ -30,7 +30,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
public function __construct(private readonly ResourceRepository $repository) {}
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
$resource = $this->extractObjectToPopulate($type, $context);
@@ -91,7 +91,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
];
}
public function supportsDenormalization($data, $type, $format = null)
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
return Resource::class === $type;
}

View File

@@ -25,7 +25,7 @@ use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
* This denormalizer rely on AbstractNormalizer for most of the job, and
* add some logic for synchronizing collection.
*/
class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface
class AccompanyingPeriodWorkDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, DenormalizerAwareInterface
{
use DenormalizerAwareTrait;
@@ -37,7 +37,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
public function __construct(private readonly AccompanyingPeriodWorkRepository $workRepository, private readonly EntityManagerInterface $em) {}
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
$work = $this->denormalizer->denormalize($data, $type, $format, \array_merge(
$context,
@@ -60,7 +60,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
&& 'accompanying_period_work' === $data['type'];
}
private function handleEvaluationCollection(array $data, AccompanyingPeriodWork $work, string $format, array $context)
private function handleEvaluationCollection(array $data, AccompanyingPeriodWork $work, string $format, array $context): void
{
$dataById = [];
$dataWithoutId = [];

View File

@@ -23,13 +23,13 @@ use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
* This denormalizer rely on AbstractNormalizer for most of the job, and
* add some logic for synchronizing collection.
*/
class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenormalizerInterface, DenormalizerAwareInterface
class AccompanyingPeriodWorkEvaluationDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, DenormalizerAwareInterface
{
use DenormalizerAwareTrait;
use ObjectToPopulateTrait;
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
$evaluation = $this->denormalizer->denormalize($data, $type, $format, \array_merge(
$context,
@@ -50,7 +50,7 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
&& 'accompanying_period_work_evaluation' === $data['type'];
}
private function handleDocumentCollection(array $data, AccompanyingPeriodWorkEvaluation $evaluation, string $format, array $context)
private function handleDocumentCollection(array $data, AccompanyingPeriodWorkEvaluation $evaluation, string $format, array $context): void
{
$dataById = [];
$dataWithoutId = [];

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Workflow\Registry;
class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;
@@ -47,7 +47,7 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements ContextAware
return $initial;
}
public function supportsNormalization($data, ?string $format = null, array $context = [])
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{
return $data instanceof AccompanyingPeriodWorkEvaluationDocument
&& 'json' === $format

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Workflow\Registry;
class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class AccompanyingPeriodWorkEvaluationNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;

View File

@@ -26,7 +26,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Workflow\Registry;
class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class AccompanyingPeriodWorkNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;

View File

@@ -17,18 +17,18 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
class GenderDocGenNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class GenderDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {}
public function supportsNormalization($data, ?string $format = null, array $context = [])
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{
return $data instanceof Gender;
}
public function normalize($gender, ?string $format = null, array $context = [])
public function normalize($gender, ?string $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
return [
'id' => $gender->getId(),

View File

@@ -29,7 +29,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
public function __construct(private readonly MembersEditorFactory $factory) {}
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
// some test about schema first...
$this->performChecks($data);
@@ -44,7 +44,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
return $this->denormalizeMove($data, $type, $format, $context);
}
public function supportsDenormalization($data, $type, $format = null)
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
return MembersEditor::class === $type;
}

View File

@@ -33,7 +33,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
class PersonDocGenNormalizer implements
ContextAwareNormalizerInterface,
\Symfony\Component\Serializer\Normalizer\NormalizerInterface,
NormalizerAwareInterface
{
use NormalizerAwareTrait;
@@ -42,7 +42,7 @@ class PersonDocGenNormalizer implements
public function __construct(private readonly PersonRenderInterface $personRender, private readonly RelationshipRepository $relationshipRepository, private readonly TranslatableStringHelper $translatableStringHelper, private readonly SummaryBudgetInterface $summaryBudget) {}
public function normalize($person, $format = null, array $context = [])
public function normalize($person, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
try {
$context = $this->addCircularToContext($person, $context);
@@ -150,7 +150,7 @@ class PersonDocGenNormalizer implements
return $data;
}
public function supportsNormalization($data, $format = null, array $context = [])
public function supportsNormalization($data, $format = null, array $context = []): bool
{
if ('docgen' !== $format) {
return false;

View File

@@ -51,7 +51,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
private readonly PhoneNumberHelperInterface $phoneNumberHelper,
) {}
public function denormalize($data, $type, $format = null, array $context = [])
public function denormalize($data, $type, $format = null, array $context = []): mixed
{
$person = $this->extractObjectToPopulate($type, $context);
@@ -178,7 +178,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
* @param Person $person
* @param string|null $format
*/
public function normalize($person, $format = null, array $context = [])
public function normalize($person, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
$groups = $context[AbstractNormalizer::GROUPS] ?? [];
@@ -215,12 +215,12 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
null];
}
public function supportsDenormalization($data, $type, $format = null)
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
{
return Person::class === $type && 'person' === ($data['type'] ?? null);
}
public function supportsNormalization($data, $format = null): bool
public function supportsNormalization($data, $format = null, array $context = []): bool
{
return $data instanceof Person && 'json' === $format;
}

View File

@@ -18,7 +18,7 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class RelationshipDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;
@@ -28,7 +28,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N
* @param Relationship $relation
* @param string|null $format
*/
public function normalize($relation, $format = null, array $context = [])
public function normalize($relation, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
$counterpart = $context['docgen:relationship:counterpart'] ?? null;
$contextPerson = array_merge($context, [
@@ -74,7 +74,7 @@ class RelationshipDocGenNormalizer implements ContextAwareNormalizerInterface, N
];
}
public function supportsNormalization($data, $format = null, array $context = [])
public function supportsNormalization($data, $format = null, array $context = []): bool
{
if ('docgen' !== $format) {
return false;

View File

@@ -23,7 +23,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte
public function __construct(private readonly SocialActionRender $render) {}
public function normalize($socialAction, $format = null, array $context = [])
public function normalize($socialAction, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
switch ($format) {
case 'json':
@@ -57,7 +57,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte
}
}
public function supportsNormalization($data, $format = null, array $context = [])
public function supportsNormalization($data, $format = null, array $context = []): bool
{
if ($data instanceof SocialAction && 'json' === $format) {
return true;

View File

@@ -17,13 +17,13 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
class SocialIssueNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class SocialIssueNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;
public function __construct(private readonly SocialIssueRender $render) {}
public function normalize($socialIssue, $format = null, array $context = [])
public function normalize($socialIssue, $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
{
/* @var SocialIssue $socialIssue */
switch ($format) {
@@ -51,7 +51,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz
}
}
public function supportsNormalization($data, $format = null, array $context = [])
public function supportsNormalization($data, $format = null, array $context = []): bool
{
if ($data instanceof SocialIssue && 'json' === $format) {
return true;

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Workflow\Registry;
class WorkflowNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
class WorkflowNormalizer implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface, NormalizerAwareInterface
{
use NormalizerAwareTrait;