fix type hinting

This commit is contained in:
2025-09-05 18:37:36 +02:00
parent c5cedb8bd6
commit fb6b26bfb5

View File

@@ -75,13 +75,13 @@ final readonly class ImportMotivesFromDirectory
// 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);
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]));
}
// stored objects
$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) {
if (!\is_array($doc)) {
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));
}
$ext = strtolower((string) pathinfo($fullPath, PATHINFO_EXTENSION));
$ext = strtolower(pathinfo($fullPath, PATHINFO_EXTENSION));
$contentType = match ($ext) {
'pdf' => 'application/pdf',
'png' => 'image/png',