Make EmailMessage & SmsMessage transport nullable

This commit is contained in:
Olivier Dolbeau 2021-01-13 11:32:36 +01:00
parent 73a70acb2b
commit d98aca06d0
2 changed files with 5 additions and 2 deletions

View File

@ -97,11 +97,14 @@ final class EmailMessage implements MessageInterface
/**
* @return $this
*/
public function transport(string $transport): self
public function transport(?string $transport): self
{
if (!$this->message instanceof Email) {
throw new LogicException('Cannot set a Transport on a RawMessage instance.');
}
if (null === $transport) {
return $this;
}
$this->message->getHeaders()->addTextHeader('X-Transport', $transport);

View File

@ -81,7 +81,7 @@ final class SmsMessage implements MessageInterface
/**
* @return $this
*/
public function transport(string $transport): self
public function transport(?string $transport): self
{
$this->transport = $transport;