Skip to content

Commit 5c86459

Browse files
authored
Update WhatsAppTemplate.php (#508)
Avoiding Error Typed property Vonage\Messages\Channel\WhatsApp\WhatsAppTemplate::$context must not be accessed before initialization
1 parent 34a172e commit 5c86459

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Messages/Channel/WhatsApp/WhatsAppTemplate.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public function toArray(): array
3434
]
3535
];
3636

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

4139
return array_merge($this->getBaseMessageUniversalOutputArray(), $returnArray);
4240
}
@@ -50,4 +48,4 @@ public function setLocale($locale): void
5048
{
5149
$this->locale = $locale;
5250
}
53-
}
51+
}

0 commit comments

Comments
 (0)