mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
DX: ensure that the return type is correct in ListPersonHelper
This commit is contained in:
parent
cf7d0c1bdb
commit
4e55f1ede7
@ -25,6 +25,7 @@ use Doctrine\ORM\Query;
|
|||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Exception;
|
use Exception;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||||
|
use RuntimeException;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
use function strlen;
|
use function strlen;
|
||||||
@ -390,8 +391,11 @@ class ListPersonHelper
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (!in_array($key, self::getAllPossibleFields(), true)) {
|
||||||
|
throw new RuntimeException("this key is not supported by this helper: {$key}");
|
||||||
|
}
|
||||||
|
|
||||||
// for fields which are associated with person
|
// for fields which are associated with person
|
||||||
if (in_array($key, ListPersonHelper::FIELDS, true)) {
|
|
||||||
return function ($value) use ($key) {
|
return function ($value) use ($key) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return $this->translator->trans($key);
|
return $this->translator->trans($key);
|
||||||
@ -401,7 +405,6 @@ class ListPersonHelper
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function addCurrentAddressAt(QueryBuilder $qb, DateTimeImmutable $date): void
|
private function addCurrentAddressAt(QueryBuilder $qb, DateTimeImmutable $date): void
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user