Skip to content

Commit ef2b65a

Browse files
committed
minor #33419 [Mailer] Renamed getName() to toString() (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- [Mailer] Renamed getName() to toString() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- 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 The `getName()` method on a Transport was introduced in 4.4. We rename it here as this method is mainly used by the profiler to display useful information about which mailer is used. This is more a string representation than a name (which is going to be introduced in the PR about multiple mailer support). Commits ------- 5b7bba9 [Mailer] Renamed getName() to toString()
2 parents bcb91ea + 5b7bba9 commit ef2b65a

28 files changed

+56
-51
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(EventDispatcherInterface $eventDispatcher, LoggerInt
4343
$this->onDoSend = $onDoSend;
4444
}
4545

46-
public function getName(): string
46+
public function __toString(): string
4747
{
4848
return 'dummy://local';
4949
}

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(string $accessKey, string $secretKey, string $region
4343
parent::__construct($client, $dispatcher, $logger);
4444
}
4545

46-
public function getName(): string
46+
public function __toString(): string
4747
{
4848
return sprintf('api://%s@ses?region=%s', $this->accessKey, $this->region);
4949
}

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(string $accessKey, string $secretKey, string $region
4242
parent::__construct($client, $dispatcher, $logger);
4343
}
4444

45-
public function getName(): string
45+
public function __toString(): string
4646
{
4747
return sprintf('http://%s@ses?region=%s', $this->accessKey, $this->region);
4848
}

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(string $key, HttpClientInterface $client = null, Eve
3636
parent::__construct($client, $dispatcher, $logger);
3737
}
3838

39-
public function getName(): string
39+
public function __toString(): string
4040
{
4141
return sprintf('api://mandrill');
4242
}

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(string $key, HttpClientInterface $client = null, Eve
3434
parent::__construct($client, $dispatcher, $logger);
3535
}
3636

37-
public function getName(): string
37+
public function __toString(): string
3838
{
3939
return sprintf('http://mandrill');
4040
}

src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(string $key, string $domain, string $region = null,
4141
parent::__construct($client, $dispatcher, $logger);
4242
}
4343

44-
public function getName(): string
44+
public function __toString(): string
4545
{
4646
return sprintf('api://%s@mailgun?region=%s', $this->domain, $this->region);
4747
}

src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(string $key, string $domain, string $region = null,
4040
parent::__construct($client, $dispatcher, $logger);
4141
}
4242

43-
public function getName(): string
43+
public function __toString(): string
4444
{
4545
return sprintf('http://%s@mailgun?region=%s', $this->domain, $this->region);
4646
}

src/Symfony/Component/Mailer/Bridge/Postmark/Transport/PostmarkApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(string $key, HttpClientInterface $client = null, Eve
3636
parent::__construct($client, $dispatcher, $logger);
3737
}
3838

39-
public function getName(): string
39+
public function __toString(): string
4040
{
4141
return sprintf('api://postmark');
4242
}

src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/Transport/SendgridTransportFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,9 @@ public function unsupportedSchemeProvider(): iterable
7676
'The "foo" scheme is not supported for mailer "sendgrid". Supported schemes are: "api", "smtp", "smtps".',
7777
];
7878
}
79+
80+
public function incompleteDsnProvider(): iterable
81+
{
82+
yield [new Dsn('api', 'sendgrid')];
83+
}
7984
}

src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(string $key, HttpClientInterface $client = null, Eve
3737
parent::__construct($client, $dispatcher, $logger);
3838
}
3939

40-
public function getName(): string
40+
public function __toString(): string
4141
{
4242
return sprintf('api://sendgrid');
4343
}

0 commit comments

Comments
 (0)