8000 minor #33787 [Mailer] Tweak some code (fabpot) · symfony/symfony@11da6f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11da6f6

Browse files
committed
minor #33787 [Mailer] Tweak some code (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- [Mailer] Tweak some code | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a Tweaks from the Notifier PR. Commits ------- ab094c0 [Mailer] Tweak some code
2 parents 3a1d361 + ab094c0 commit 11da6f6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Symfony/Component/Mailer/Transport/RoundRobinTransport.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class RoundRobinTransport implements TransportInterface
3535
public function __construct(array $transports, int $retryPeriod = 60)
3636
{
3737
if (!$transports) {
38-
throw new TransportException(__CLASS__.' must have at least one transport configured.');
38+
throw new TransportException(sprintf('"%s" must have at least one transport configured.', static::class));
3939
}
4040

4141
$this->transports = $transports;
@@ -58,9 +58,7 @@ public function send(RawMessage $message, Envelope $envelope = null): ?SentMessa
5858

5959
public function __toString(): string
6060
{
61-
return $this->getNameSymbol().'('.implode(' ', array_map(function (TransportInterface $transport) {
62-
return (string) $transport;
63-
}, $this->transports)).')';
61+
return $this->getNameSymbol().'('.implode(' ', array_map('strval', $this->transports)).')';
6462
}
6563

6664
/**

src/Symfony/Component/Mailer/Transport/Transports.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* @author Fabien Potencier <fabien@symfony.com>
2323
*/
24-
class Transports implements TransportInterface
24+
final class Transports implements TransportInterface
2525
{
2626
private $transports;
2727
private $default;
@@ -64,6 +64,6 @@ public function send(RawMessage $message, Envelope $envelope = null): ?SentMessa
6464

6565
public function __toString(): string
6666
{
67-
return 'all';
67+
return '['.implode(',', array_keys($this->transports)).']';
6868
}
6969
}

0 commit comments

Comments
 (0)
0