mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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,16 +391,18 @@ class ListPersonHelper
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// for fields which are associated with person
|
if (!in_array($key, self::getAllPossibleFields(), true)) {
|
||||||
if (in_array($key, ListPersonHelper::FIELDS, true)) {
|
throw new RuntimeException("this key is not supported by this helper: {$key}");
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return $this->translator->trans($key);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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