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:
@@ -21,11 +21,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 in_array;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* This denormalizer rely on AbstractNormalizer for most of the job, and
|
||||
* add some logic for synchronizing collection.
|
||||
@@ -44,12 +39,12 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
$work = $this->denormalizer->denormalize($data, $type, $format, array_merge(
|
||||
$work = $this->denormalizer->denormalize($data, $type, $format, \array_merge(
|
||||
$context,
|
||||
['skip' => self::class]
|
||||
));
|
||||
|
||||
if (in_array('accompanying_period_work:edit', $context['groups'] ?? [], true)) {
|
||||
if (\in_array('accompanying_period_work:edit', $context['groups'] ?? [], true)) {
|
||||
$this->handleEvaluationCollection($data, $work, $format, $context);
|
||||
}
|
||||
|
||||
@@ -60,8 +55,8 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
{
|
||||
return AccompanyingPeriodWork::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' === $data['type'];
|
||||
}
|
||||
|
||||
@@ -71,7 +66,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
$dataWithoutId = [];
|
||||
|
||||
foreach ($data['accompanyingPeriodWorkEvaluations'] as $e) {
|
||||
if (array_key_exists('id', $e)) {
|
||||
if (\array_key_exists('id', $e)) {
|
||||
$dataById[$e['id']] = $e;
|
||||
} else {
|
||||
$dataWithoutId[] = $e;
|
||||
@@ -81,7 +76,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
// partition the separate kept evaluations and removed one
|
||||
[$kept, $removed] = $work->getAccompanyingPeriodWorkEvaluations()
|
||||
->partition(
|
||||
static fn (int $key, AccompanyingPeriodWorkEvaluation $a) => array_key_exists($a->getId(), $dataById)
|
||||
static fn (int $key, AccompanyingPeriodWorkEvaluation $a) => \array_key_exists($a->getId(), $dataById)
|
||||
);
|
||||
|
||||
// remove the evaluations from work
|
||||
@@ -94,7 +89,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
$dataById[$k->getId()],
|
||||
AccompanyingPeriodWorkEvaluation::class,
|
||||
$format,
|
||||
array_merge(
|
||||
\array_merge(
|
||||
$context,
|
||||
[
|
||||
'groups' => ['write'],
|
||||
@@ -109,7 +104,7 @@ class AccompanyingPeriodWorkDenormalizer implements ContextAwareDenormalizerInte
|
||||
$newData,
|
||||
AccompanyingPeriodWorkEvaluation::class,
|
||||
$format,
|
||||
array_merge(
|
||||
\array_merge(
|
||||
$context,
|
||||
['groups' => ['accompanying_period_work_evaluation:create']]
|
||||
)
|
||||
|
Reference in New Issue
Block a user