Skip to content

Commit

Permalink
Update WhatsAppTemplate.php (#508)
Browse files Browse the repository at this point in the history
Avoiding Error Typed property
Vonage\Messages\Channel\WhatsApp\WhatsAppTemplate::$context must not be accessed before initialization
  • Loading branch information
Pier-d authored Oct 14, 2024
1 parent 34a172e commit 5c86459
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Messages/Channel/WhatsApp/WhatsAppTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public function toArray(): array
]
];

if (!is_null($this->context)) {
$returnArray['context'] = $this->context;
}
$returnArray['context'] = $this->context ?? null;

return array_merge($this->getBaseMessageUniversalOutputArray(), $returnArray);
}
Expand All @@ -50,4 +48,4 @@ public function setLocale($locale): void
{
$this->locale = $locale;
}
}
}

0 comments on commit 5c86459

Please sign in to comment.