-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mime] Remove NamedAddress #33270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mime] Remove NamedAddress #33270
Conversation
29a2495
to
240feb0
Compare
240feb0
to
eb7d74e
Compare
This PR was merged into the 4.4 branch. Discussion ---------- [Mime] Remove NamedAddress | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | yes <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a While working on #33091, we realize that having both `NamedAddress` and `Address` brings some unneeded complexity. Initially, I added both as some headers do not support `NamedAddress`es. But the code already does the right thing by "downgrading" them to `Address` instances. So, let's simplify our internal code and make life easier for our users too. Commits ------- eb7d74e [Mime] Remove NamedAddress
@@ -93,15 +90,15 @@ public function getReturnPath(): string | |||
/** | |||
* @return $this | |||
*/ | |||
public function addFrom(string $address, string $name = null): self | |||
public function addFrom(string $address, string $name = ''): self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be documented in the upgrade guide too, as the parameter type changed from string|null
to string
, which is also a BC break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter type was string
and null
was only to express that no arguments was passed. Anyway, I think that's minor and we should not waste our time on such things.
@@ -21,14 +21,15 @@ | |||
/** | |||
* @author Fabien Potencier <fabien@symfony.com> | |||
*/ | |||
class Address | |||
final class Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be documented in the upgrade guide too, as it is a BC break.
@@ -61,7 +68,7 @@ public function getEncodedAddress(): string | |||
|
|||
public function toString(): string | |||
{ | |||
return $this->getEncodedAddress(); | |||
return ($n = $this->getName()) ? $n.' <'.$this->getEncodedAddress().'>' : $this->getEncodedAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use $this->name
directly rather than adding another variable.
This PR was merged into the 4.4 branch. Discussion ---------- [Mailer][Mime] NamedAddress was removed in 4.4 It was removed in 4.4 (symfony/symfony#33270) in favor of using Address with a second arg. Commits ------- 9b6eb23 [Mailer][Mime] NamedAddress was removed in 4.4
…(ogizanagi) This PR was merged into the 4.4 branch. Discussion ---------- [Mailer][MailchimpBridge] Fix NamedAddress obsolete paths | Q | A | ------------- | --- | Branch? | 4.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | N/A As NamedAddress was removed in #33270 (4.4) and this bridge does require `symfony/mailer >= 4.4`. Commits ------- f14d082 [Mailer][MailchimpBridge] Fix NamedAddress obsolete paths
While working on #33091, we realizes that having both
NamedAddress
andAddress
brings some unneeded complexity. Initially, I added both as some headers do not supportNamedAddress
es. But the code already does the right thing by "downgrading" them toAddress
instances. So, let's simplify our internal code and make life easier for our users too.