Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  Revert "fix PHP 7 compatibility"
  • Loading branch information
fabpot committed May 29, 2024
2 parents be07d1d + 99add8a commit 51d6a7f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,11 @@ public function toIterable(): iterable

public function ensureValidity(): void
{
$to = (null !== $header = $this->headers->get('To')) ? $header->getBody() : null;
$cc = (null !== $header = $this->headers->get('Cc')) ? $header->getBody() : null;
$bcc = (null !== $header = $this->headers->get('Bcc')) ? $header->getBody() : null;

if (!$to && !$cc && !$bcc) {
if (!$this->headers->get('To')?->getBody() && !$this->headers->get('Cc')?->getBody() && !$this->headers->get('Bcc')?->getBody()) {
throw new LogicException('An email must have a "To", "Cc", or "Bcc" header.');
}

$from = (null !== $header = $this->headers->get('From')) ? $header->getBody() : null;
$sender = (null !== $header = $this->headers->get('Sender')) ? $header->getBody() : null;

if (!$from && !$sender) {
if (!$this->headers->get('From')?->getBody() && !$this->headers->get('Sender')?->getBody()) {
throw new LogicException('An email must have a "From" or a "Sender" header.');
}

Expand Down

0 comments on commit 51d6a7f

Please sign in to comment.