- Default value of bcc if nothing was provided

This commit is contained in:
Dave Mc Nicoll 2023-11-01 11:33:38 -04:00
parent b284b67d91
commit fe6fdd3987
1 changed files with 8 additions and 3 deletions

View File

@ -73,12 +73,12 @@ class SymfonyMailer implements MailerInterface
protected function cc() : array
{
return $this->arrayToAddress($this->cc);
return $this->arrayToAddress($this->cc ?? []);
}
protected function bcc() : array
{
return $this->arrayToAddress($this->bcc);
return $this->arrayToAddress($this->bcc ?? []);
}
protected function arrayToAddress(string|\Stringable|array $array) : array
@ -86,7 +86,12 @@ class SymfonyMailer implements MailerInterface
$list = [];
foreach((array) $array as $addr => $name) {
$list[] = "$name <$addr>";
if (is_numeric($addr)) {
$list[] = $name;
}
else {
$list[] = "$name <$addr>";
}
}
return $list;