mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
DX: rector rules upt to PHP 74
This commit is contained in:
@@ -150,12 +150,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
|
||||
$this->closingMotiveRender->renderString($period->getClosingMotive(), []) : '',
|
||||
'ref' => $this->normalizer->normalize($period->getUser(), $format, $userContext),
|
||||
'hasRef' => $period->getUser() !== null,
|
||||
'socialIssuesText' => implode(', ', array_map(function (SocialIssue $s) {
|
||||
return $this->socialIssueRender->renderString($s, []);
|
||||
}, $period->getSocialIssues()->toArray())),
|
||||
'scopesText' => implode(', ', array_map(function (Scope $s) {
|
||||
return $this->translatableStringHelper->localize($s->getName());
|
||||
}, $scopes)),
|
||||
'socialIssuesText' => implode(', ', array_map(fn(SocialIssue $s) => $this->socialIssueRender->renderString($s, []), $period->getSocialIssues()->toArray())),
|
||||
'scopesText' => implode(', ', array_map(fn(Scope $s) => $this->translatableStringHelper->localize($s->getName()), $scopes)),
|
||||
'hasRequestor' => $period->getRequestor() !== null,
|
||||
'requestorKind' => $period->getRequestorKind(),
|
||||
'hasLocation' => $period->getLocation() !== null,
|
||||
|
@@ -48,9 +48,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz
|
||||
$initial = $this->normalizer->normalize($object, $format, array_merge(
|
||||
$context,
|
||||
[self::IGNORE_EVALUATION => spl_object_hash($object)],
|
||||
[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => static function ($object, $format, $context) {
|
||||
return $object->getId();
|
||||
}]
|
||||
[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => static fn($object, $format, $context) => $object->getId()]
|
||||
));
|
||||
|
||||
// due to bug: https://api-platform.com/docs/core/serialization/#collection-relation
|
||||
|
@@ -94,9 +94,7 @@ class PersonDocGenNormalizer implements
|
||||
// we simplify the list of attributes for the embedded persons
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'],
|
||||
// when a person reference the same person... take care of circular references
|
||||
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object, $format, $context) {
|
||||
return $this->normalizer->normalize(null, $format, $context);
|
||||
},
|
||||
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => fn($object, $format, $context) => $this->normalizer->normalize(null, $format, $context),
|
||||
]);
|
||||
|
||||
if (null === $person) {
|
||||
@@ -117,9 +115,7 @@ class PersonDocGenNormalizer implements
|
||||
'altNames' => implode(
|
||||
', ',
|
||||
array_map(
|
||||
static function (PersonAltName $altName) {
|
||||
return $altName->getLabel();
|
||||
},
|
||||
static fn(PersonAltName $altName) => $altName->getLabel(),
|
||||
$person->getAltNames()->toArray()
|
||||
)
|
||||
),
|
||||
|
@@ -257,12 +257,10 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
||||
{
|
||||
return $altNames
|
||||
->map(
|
||||
static function (PersonAltName $personAltName): array {
|
||||
return [
|
||||
'key' => $personAltName->getKey(),
|
||||
'label' => $personAltName->getLabel(),
|
||||
];
|
||||
}
|
||||
static fn(PersonAltName $personAltName): array => [
|
||||
'key' => $personAltName->getKey(),
|
||||
'label' => $personAltName->getLabel(),
|
||||
]
|
||||
)
|
||||
->toArray();
|
||||
}
|
||||
|
@@ -37,9 +37,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz
|
||||
'type' => 'social_issue',
|
||||
'id' => $socialIssue->getId(),
|
||||
'parent_id' => $socialIssue->hasParent() ? $socialIssue->getParent()->getId() : null,
|
||||
'children_ids' => $socialIssue->getChildren()->map(static function (SocialIssue $si) {
|
||||
return $si->getId();
|
||||
}),
|
||||
'children_ids' => $socialIssue->getChildren()->map(static fn(SocialIssue $si) => $si->getId()),
|
||||
'title' => $socialIssue->getTitle(),
|
||||
'text' => $this->render->renderString($socialIssue, []),
|
||||
];
|
||||
|
Reference in New Issue
Block a user