From 99add8a2304ae4c2c519586f8561ffc99ea94a03 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 29 May 2024 17:15:51 +0200 Subject: [PATCH] Revert "fix PHP 7 compatibility" This reverts commit c5c6f08a7113454ab5aaee99cdcbb2f0fcca94c6. --- Message.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Message.php b/Message.php index 9b79a7b..fc8940e 100644 --- a/Message.php +++ b/Message.php @@ -130,18 +130,11 @@ public function toIterable(): iterable */ public function ensureValidity() { - $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.'); }