fix code syntax using php stan

This commit is contained in:
nobohan 2021-12-06 10:06:55 +01:00
parent 3c3d63e286
commit 15c7c6ccde
5 changed files with 5 additions and 7 deletions

View File

@ -289,7 +289,7 @@ class ActivityType extends AbstractType
if (null === $thirdpartyAsString) { if (null === $thirdpartyAsString) {
return []; return [];
} }
return array_map( return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString) explode(',', $thirdpartyAsString)

View File

@ -186,7 +186,7 @@ class HouseholdMemberController extends ApiController
$_format, $_format,
['groups' => ['read']] ['groups' => ['read']]
); );
} catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) { } catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e); throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
} }

View File

@ -25,9 +25,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource; use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap; use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck; use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ResourceDuplicateCheck;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\AccompanyingPeriodValidity;
use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTime; use DateTime;
use DateTimeImmutable; use DateTimeImmutable;

View File

@ -24,4 +24,4 @@ class AccompanyingPeriodValidity extends Constraint
{ {
return self::CLASS_CONSTRAINT; return self::CLASS_CONSTRAINT;
} }
} }

View File

@ -17,10 +17,10 @@ use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Exception\UnexpectedValueException;
use function in_array;
class AccompanyingPeriodValidityValidator extends ConstraintValidator class AccompanyingPeriodValidityValidator extends ConstraintValidator
{ {
private ActivityACLAwareRepository $activityRepository; private ActivityACLAwareRepository $activityRepository;
public function __construct(ActivityACLAwareRepository $activityRepository) public function __construct(ActivityACLAwareRepository $activityRepository)
@ -30,7 +30,6 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
public function validate($period, Constraint $constraint) public function validate($period, Constraint $constraint)
{ {
if (!$constraint instanceof AccompanyingPeriodValidity) { if (!$constraint instanceof AccompanyingPeriodValidity) {
throw new UnexpectedTypeException($constraint, AccompanyingPeriodValidity::class); throw new UnexpectedTypeException($constraint, AccompanyingPeriodValidity::class);
} }
@ -60,6 +59,5 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
->addViolation(); ->addViolation();
} }
} }
} }
} }