Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4169746

Browse filesBrowse files
committed
bug #39812 Make EmailMessage & SmsMessage transport nullable (odolbeau)
This PR was merged into the 5.1 branch. Discussion ---------- Make EmailMessage & SmsMessage transport nullable | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT Ideally, this should have been done in #38361 as it's exactly the same problem: the `transport` method can be called with `null` with deserializing a message from json (for example). Commits ------- d98aca0 Make EmailMessage & SmsMessage transport nullable
2 parents db8ef30 + d98aca0 commit 4169746
Copy full SHA for 4169746

File tree

2 files changed

+5
-2
lines changed
Filter options

2 files changed

+5
-2
lines changed

‎src/Symfony/Component/Notifier/Message/EmailMessage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Message/EmailMessage.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,14 @@ public function getOptions(): ?MessageOptionsInterface
9797
/**
9898
* @return $this
9999
*/
100-
public function transport(string $transport): self
100+
public function transport(?string $transport): self
101101
{
102102
if (!$this->message instanceof Email) {
103103
throw new LogicException('Cannot set a Transport on a RawMessage instance.');
104104
}
105+
if (null === $transport) {
106+
return $this;
107+
}
105108

106109
$this->message->getHeaders()->addTextHeader('X-Transport', $transport);
107110

‎src/Symfony/Component/Notifier/Message/SmsMessage.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Message/SmsMessage.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getSubject(): string
8181
/**
8282
* @return $this
8383
*/
84-
public function transport(string $transport): self
84+
public function transport(?string $transport): self
8585
{
8686
$this->transport = $transport;
8787

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.