While running a code to auto-send an email through Sendgrid APIss, we are getting the following error:
Parse error: syntax error, unexpected '[', expecting ')' in E:\xampp\htdocs\sendgrid-php\lib\helpers\mail\Mail.php on line 37
Below is the mail.php file code:
public function jsonSerialize()
{
return array_filter(
[
'email' => $this->getEmail()
],
function ($value) {
return $value !== `enter code here`null;
}
) ?: null;
}