Skip to content

Commit 3b58fa0

Browse files
committed
fix: phpstan error by checking for eml file path presents
1 parent 8f9babb commit 3b58fa0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Controller/Api/MailArchiveController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,15 @@ public function fetchEmlHeaders(Request $request, Context $context): JsonRespons
6565
}
6666

6767
$mainRequest->attributes->set(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_ID, $mailArchive->getSalesChannelId());
68-
$emlMessage = $this->emlFileManager->getEmlAsMessage($mailArchive->getEmlPath());
6968

69+
$emlPath = $mailArchive->getEmlPath();
70+
if ($emlPath === null) {
71+
return new JsonResponse([
72+
'headers' => [],
73+
]);
74+
}
75+
76+
$emlMessage = $this->emlFileManager->getEmlAsMessage($mailArchive->getEmlPath());
7077
$headers = [];
7178
foreach ($emlMessage->getAllHeaders() as $header) {
7279
$headers[$header->getName()] = $header->getValue();

0 commit comments

Comments
 (0)