mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 19:43:49 +00:00
Php cs fixes and phpstan
This commit is contained in:
@@ -30,8 +30,11 @@ class GenderFilter implements
|
||||
DataTransformerInterface
|
||||
{
|
||||
// inject gender repository and find the active genders so that you can pass them to the ChoiceType (ordered by ordering)
|
||||
public function __construct(private readonly TranslatorInterface $translator, private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
private readonly GenderRepository $genderRepository) {}
|
||||
public function __construct(
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
private readonly GenderRepository $genderRepository
|
||||
) {}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
@@ -44,7 +47,7 @@ class GenderFilter implements
|
||||
$isIn = $qb->expr()->in('person.gender', ':person_gender');
|
||||
|
||||
$acceptedGenders = $data['accepted_genders_entity'];
|
||||
$nullIncluded = in_array(null, $acceptedGenders, true);
|
||||
$nullIncluded = in_array(null, $acceptedGenders ?? [], true);
|
||||
|
||||
if (!$nullIncluded) {
|
||||
$clause = $isIn;
|
||||
@@ -53,7 +56,7 @@ class GenderFilter implements
|
||||
}
|
||||
|
||||
$qb->andWhere($clause);
|
||||
$qb->setParameter('person_gender', array_filter($acceptedGenders, fn ($gender) => null !== $gender));
|
||||
$qb->setParameter('person_gender', array_filter($acceptedGenders ?? [], fn ($gender) => null !== $gender));
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
@@ -80,6 +83,7 @@ class GenderFilter implements
|
||||
|
||||
public function transformData(?array $before): array
|
||||
{
|
||||
$transformedData = [];
|
||||
$transformedData['accepted_genders_entity'] = $before['accepted_genders_entity'] ?? [];
|
||||
|
||||
if (array_key_exists('accepted_genders', $before)) {
|
||||
|
Reference in New Issue
Block a user