From 7303140fd3baef949800ab99f002bcd6d47ccbdd Mon Sep 17 00:00:00 2001 From: Pier <61907396+Pier-d@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:27:30 +0200 Subject: [PATCH] Update WhatsAppImage.php (#512) Avoiding Error Typed property Vonage\Messages\Channel\WhatsApp\WhatsAppImage::$context must not be accessed before initialization --- src/Messages/Channel/WhatsApp/WhatsAppImage.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Messages/Channel/WhatsApp/WhatsAppImage.php b/src/Messages/Channel/WhatsApp/WhatsAppImage.php index 17ce1c7a..8a702daa 100644 --- a/src/Messages/Channel/WhatsApp/WhatsAppImage.php +++ b/src/Messages/Channel/WhatsApp/WhatsAppImage.php @@ -26,10 +26,7 @@ public function toArray(): array { $returnArray = $this->getBaseMessageUniversalOutputArray(); $returnArray['image'] = $this->image->toArray(); - - if (!is_null($this->context)) { - $returnArray['context'] = $this->context; - } + $returnArray['context'] = $this->context ?? null; return $returnArray; }