From fb6b26bfb52d817ab8cde028ef5c052d0bc5927c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 5 Sep 2025 18:37:36 +0200 Subject: [PATCH] fix type hinting --- .../src/Service/Import/ImportMotivesFromDirectory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillTicketBundle/src/Service/Import/ImportMotivesFromDirectory.php b/src/Bundle/ChillTicketBundle/src/Service/Import/ImportMotivesFromDirectory.php index 946a25922..2bd1178b0 100644 --- a/src/Bundle/ChillTicketBundle/src/Service/Import/ImportMotivesFromDirectory.php +++ b/src/Bundle/ChillTicketBundle/src/Service/Import/ImportMotivesFromDirectory.php @@ -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',