apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -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'");
}
}