mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-11 09:14:59 +00:00
fix type hinting
This commit is contained in:
@@ -75,13 +75,13 @@ final readonly class ImportMotivesFromDirectory
|
|||||||
|
|
||||||
// supplementary informations (support both keys with/without underscore)
|
// supplementary informations (support both keys with/without underscore)
|
||||||
$suppKey = array_key_exists('supplementary_informations', $item) ? 'supplementary_informations' : (array_key_exists('supplementary informations', $item) ? 'supplementary informations' : null);
|
$suppKey = array_key_exists('supplementary_informations', $item) ? 'supplementary_informations' : (array_key_exists('supplementary informations', $item) ? 'supplementary informations' : null);
|
||||||
if ($suppKey && \is_array($item[$suppKey])) {
|
if (null !== $suppKey && \is_array($item[$suppKey])) {
|
||||||
$motive->setSupplementaryComment(array_map(fn (array $supplementaryDefinition) => ['label' => $supplementaryDefinition['label'][$lang]], $item[$suppKey]));
|
$motive->setSupplementaryComment(array_map(fn (array $supplementaryDefinition) => ['label' => $supplementaryDefinition['label'][$lang]], $item[$suppKey]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// stored objects
|
// stored objects
|
||||||
$storedKey = array_key_exists('stored_objects', $item) ? 'stored_objects' : (array_key_exists('stored object', $item) ? 'stored object' : null);
|
$storedKey = array_key_exists('stored_objects', $item) ? 'stored_objects' : (array_key_exists('stored object', $item) ? 'stored object' : null);
|
||||||
if ($storedKey && \is_array($item[$storedKey])) {
|
if (null !== $storedKey && \is_array($item[$storedKey])) {
|
||||||
foreach ($item[$storedKey] as $docIndex => $doc) {
|
foreach ($item[$storedKey] as $docIndex => $doc) {
|
||||||
if (!\is_array($doc)) {
|
if (!\is_array($doc)) {
|
||||||
throw new \RuntimeException(sprintf('Item %d, stored object %d: invalid entry.', $index, $docIndex));
|
throw new \RuntimeException(sprintf('Item %d, stored object %d: invalid entry.', $index, $docIndex));
|
||||||
@@ -111,7 +111,7 @@ final readonly class ImportMotivesFromDirectory
|
|||||||
throw new \RuntimeException(sprintf('Unable to read file: %s', $fullPath));
|
throw new \RuntimeException(sprintf('Unable to read file: %s', $fullPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
$ext = strtolower((string) pathinfo($fullPath, PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($fullPath, PATHINFO_EXTENSION));
|
||||||
$contentType = match ($ext) {
|
$contentType = match ($ext) {
|
||||||
'pdf' => 'application/pdf',
|
'pdf' => 'application/pdf',
|
||||||
'png' => 'image/png',
|
'png' => 'image/png',
|
||||||
|
Reference in New Issue
Block a user