mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +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 Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
use RuntimeException;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function in_array;
|
||||
use function strlen;
|
||||
@ -390,16 +391,18 @@ class ListPersonHelper
|
||||
};
|
||||
|
||||
default:
|
||||
// for fields which are associated with person
|
||||
if (in_array($key, ListPersonHelper::FIELDS, true)) {
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
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
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user