From 8d8183a61996ef465acd162f02ef73b9a3030a4f Mon Sep 17 00:00:00 2001 From: Pier <61907396+Pier-d@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:26:42 +0200 Subject: [PATCH] Update WhatsAppFile.php (#511) Avoiding Error Typed property Vonage\Messages\Channel\WhatsApp\WhatsAppFile::$context must not be accessed before initialization --- src/Messages/Channel/WhatsApp/WhatsAppFile.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Messages/Channel/WhatsApp/WhatsAppFile.php b/src/Messages/Channel/WhatsApp/WhatsAppFile.php index 2fdacf12..7f9274c1 100644 --- a/src/Messages/Channel/WhatsApp/WhatsAppFile.php +++ b/src/Messages/Channel/WhatsApp/WhatsAppFile.php @@ -26,11 +26,8 @@ public function toArray(): array { $returnArray = $this->getBaseMessageUniversalOutputArray(); $returnArray['file'] = $this->fileObject->toArray(); - - if (!is_null($this->context)) { - $returnArray['context'] = $this->context; - } + $returnArray['context'] = $this->context ?? null; return $returnArray; } -} \ No newline at end of file +}