mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -19,10 +19,6 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* This denormalizer rely on AbstractNormalizer for most of the job, and
|
||||
* add some logic for synchronizing collection.
|
||||
@@ -35,7 +31,7 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
|
||||
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
$evaluation = $this->denormalizer->denormalize($data, $type, $format, array_merge(
|
||||
$evaluation = $this->denormalizer->denormalize($data, $type, $format, \array_merge(
|
||||
$context,
|
||||
['skip' => self::class]
|
||||
));
|
||||
@@ -49,8 +45,8 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
|
||||
{
|
||||
return AccompanyingPeriodWorkEvaluation::class === $type
|
||||
&& self::class !== ($context['skip'] ?? null)
|
||||
&& is_array($data)
|
||||
&& array_key_exists('type', $data)
|
||||
&& \is_array($data)
|
||||
&& \array_key_exists('type', $data)
|
||||
&& 'accompanying_period_work_evaluation' === $data['type'];
|
||||
}
|
||||
|
||||
@@ -60,17 +56,17 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
|
||||
$dataWithoutId = [];
|
||||
|
||||
foreach ($data['documents'] as $e) {
|
||||
if (array_key_exists('id', $e)) {
|
||||
if (\array_key_exists('id', $e)) {
|
||||
$dataById[$e['id']] = $e;
|
||||
} else {
|
||||
$dataWithoutId[] = $e;
|
||||
}
|
||||
}
|
||||
|
||||
//partition the separate kept documents and removed one
|
||||
// partition the separate kept documents and removed one
|
||||
[$kept, $removed] = $evaluation->getDocuments()
|
||||
->partition(
|
||||
static fn (int $key, AccompanyingPeriodWorkEvaluationDocument $a) => array_key_exists($a->getId(), $dataById)
|
||||
static fn (int $key, AccompanyingPeriodWorkEvaluationDocument $a) => \array_key_exists($a->getId(), $dataById)
|
||||
);
|
||||
|
||||
// remove the document from evaluation
|
||||
@@ -84,7 +80,7 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
|
||||
$dataById[$k->getId()],
|
||||
AccompanyingPeriodWorkEvaluationDocument::class,
|
||||
$format,
|
||||
array_merge(
|
||||
\array_merge(
|
||||
$context,
|
||||
[
|
||||
'groups' => ['write'],
|
||||
@@ -99,7 +95,7 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements ContextAwareDenorm
|
||||
$newData,
|
||||
AccompanyingPeriodWorkEvaluationDocument::class,
|
||||
$format,
|
||||
array_merge(
|
||||
\array_merge(
|
||||
$context,
|
||||
['groups' => ['accompanying_period_work_evaluation:create']]
|
||||
)
|
||||
|
Reference in New Issue
Block a user