mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 04:23:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,15 +18,11 @@ use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Household\MembersEditor;
|
||||
use Chill\PersonBundle\Household\MembersEditorFactory;
|
||||
use DateTimeImmutable;
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
|
||||
use UnexpectedValueException;
|
||||
use function array_key_exists;
|
||||
|
||||
class MembersEditorNormalizer implements DenormalizerAwareInterface, DenormalizerInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
@@ -66,7 +62,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
);
|
||||
$startDate = $this->denormalizer->denormalize(
|
||||
$concerned['start_date'] ?? null,
|
||||
DateTimeImmutable::class,
|
||||
\DateTimeImmutable::class,
|
||||
$format,
|
||||
$context
|
||||
);
|
||||
@@ -75,9 +71,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
null === $person
|
||||
&& null === $startDate
|
||||
) {
|
||||
throw new Exception\InvalidArgumentException('position with ' .
|
||||
"key {$key} could not be denormalized: missing " .
|
||||
'person or start_date.');
|
||||
throw new Exception\InvalidArgumentException('position with '."key {$key} could not be denormalized: missing ".'person or start_date.');
|
||||
}
|
||||
|
||||
$editor->leaveMovement($startDate, $person);
|
||||
@@ -112,7 +106,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
$context
|
||||
);
|
||||
|
||||
if (array_key_exists('position', $concerned)) {
|
||||
if (\array_key_exists('position', $concerned)) {
|
||||
$position = $this->denormalizer->denormalize(
|
||||
$concerned['position'] ?? null,
|
||||
Position::class,
|
||||
@@ -125,7 +119,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
|
||||
$startDate = $this->denormalizer->denormalize(
|
||||
$concerned['start_date'] ?? null,
|
||||
DateTimeImmutable::class,
|
||||
\DateTimeImmutable::class,
|
||||
$format,
|
||||
$context
|
||||
);
|
||||
@@ -138,9 +132,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
&& null === $position
|
||||
&& null === $startDate
|
||||
) {
|
||||
throw new Exception\InvalidArgumentException('position with ' .
|
||||
"key {$key} could not be denormalized: missing " .
|
||||
'person, position or start_date.');
|
||||
throw new Exception\InvalidArgumentException('position with '."key {$key} could not be denormalized: missing ".'person, position or start_date.');
|
||||
}
|
||||
|
||||
$editor->addMovement(
|
||||
@@ -155,10 +147,10 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
if (null !== $data['composition']) {
|
||||
$compositionType = $this->denormalizer->denormalize($data['composition']['household_composition_type'], HouseholdCompositionType::class, $format, $context);
|
||||
$numberOfChildren = $data['composition']['number_of_children'];
|
||||
$startDate = $this->denormalizer->denormalize($data['composition']['start_date'], DateTimeImmutable::class, $format, $context);
|
||||
$startDate = $this->denormalizer->denormalize($data['composition']['start_date'], \DateTimeImmutable::class, $format, $context);
|
||||
|
||||
if (null === $compositionType) {
|
||||
throw new UnexpectedValueException('composition type cannot be null');
|
||||
throw new \UnexpectedValueException('composition type cannot be null');
|
||||
}
|
||||
|
||||
$householdComposition = (new HouseholdComposition())
|
||||
@@ -181,7 +173,7 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
|
||||
throw new Exception\UnexpectedValueException("The schema does not have any key 'concerned'");
|
||||
}
|
||||
|
||||
if (false === array_key_exists('destination', $data)) {
|
||||
if (false === \array_key_exists('destination', $data)) {
|
||||
throw new Exception\UnexpectedValueException("The schema does not have any key 'destination'");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user