chore: fix phpstan errors, add inline docs
This commit is contained in:
@@ -51,7 +51,10 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
* Mailjet may send one event or a batch of events, so normalize both shapes
|
||||
* into a list before dispatching.
|
||||
*
|
||||
* @param array<int|string, mixed> $payload
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private function normalizeEvents(array $payload): array
|
||||
@@ -61,7 +64,14 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
||||
}
|
||||
|
||||
if (array_is_list($payload)) {
|
||||
return array_values(array_filter($payload, static fn (mixed $entry): bool => is_array($entry)));
|
||||
$events = [];
|
||||
foreach ($payload as $entry) {
|
||||
if (true === is_array($entry)) {
|
||||
$events[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
return [$payload];
|
||||
|
||||
Reference in New Issue
Block a user