Skip to content

Commit

Permalink
bug #37167 [Mime] use fromString when creating a new Address (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] use fromString when creating a new Address

| 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

When creating an Address, there are two ways right now in 4.4: `Address::create()` which takes an email or an instance of Address and `Address::fromString()` which takes an email or an email+name.

In 4.4, I propose to make `create` supports everything possible. And in 5.2, I will probably propose to deprecate `fromString()`.

Commits
-------

de68787 [Mime] use fromString when creating a new Adress
  • Loading branch information
fabpot committed Jun 9, 2020
2 parents 749380a + de68787 commit 5b719d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Mime/Address.php
Expand Up @@ -89,7 +89,7 @@ public static function create($address): self
return $address;
}
if (\is_string($address)) {
return new self($address);
return self::fromString($address);
}

throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s") given).', \is_object($address) ? \get_class($address) : \gettype($address)));
Expand Down

0 comments on commit 5b719d1

Please sign in to comment.