Skip to content

Commit

Permalink
Update WhatsAppFile.php (#511)
Browse files Browse the repository at this point in the history
Avoiding Error Typed property Vonage\Messages\Channel\WhatsApp\WhatsAppFile::$context must not be accessed before initialization
  • Loading branch information
Pier-d authored Oct 14, 2024
1 parent fbffb95 commit 8d8183a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Messages/Channel/WhatsApp/WhatsAppFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

0 comments on commit 8d8183a

Please sign in to comment.