8000 Removed useless SmtpsTransport and added to DI · symfony/symfony@39f4f03 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39f4f03

Browse files
committed
Removed useless SmtpsTransport and added to DI
1 parent 82e19b0 commit 39f4f03

File tree

10 files changed

+21
-73
lines changed

10 files changed

+21
-73
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
8484
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
8585
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
86+
use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
8687
use Symfony\Component\Mailer\Mailer;
8788
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
8889
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
@@ -2128,6 +2129,7 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co
21282129
MailgunTransportFactory::class => 'mailer.transport_factory.mailgun',
21292130
PostmarkTransportFactory::class => 'mailer.transport_factory.postmark',
21302131
SendgridTransportFactory::class => 'mailer.transport_factory.sendgrid',
2132+
SendinblueTransportFactory::class => 'mailer.transport_factory.sendinblue',
21312133
];
21322134

21332135
foreach ($classToServices as $class => $service) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_transports.php

Copy file name to clipboard
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
1818
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
1919
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
20+
use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
2021
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
2122
use Symfony\Component\Mailer\Transport\NativeTransportFactory;
2223
use Symfony\Component\Mailer\Transport\NullTransportFactory;
@@ -65,6 +66,10 @@
6566
->parent('mailer.transport_factory.abstract')
6667
->tag('mailer.transport_factory')
6768

69+
->set('mailer.transport_factory.sendinblue', SendinblueTransportFactory::class)
70+
->parent('mailer.transport_factory.abstract')
71+
->tag('mailer.transport_factory')
72+
6873
->set('mailer.transport_factory.smtp', EsmtpTransportFactory::class)
6974
->parent('mailer.transport_factory.abstract')
7075
->tag('mailer.transport_factory', ['priority' => -100])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CHANGELOG
22
=========
33

4-
5.3.0
4+
5.2.0
55
-----
66

77
* Added the bridge

src/Symfony/Component/Mailer/Bridge/Sendinblue/Tests/Transport/SendinblueTransportFactoryTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ public function supportsProvider(): iterable
2929
true,
3030
];
3131

32-
yield [
33-
new Dsn('sendinblue+smtps', 'default'),
34-
true,
35-
];
36-
3732
yield [
3833
new Dsn('sendinblue+smtp', 'example.com'),
3934
true,
@@ -58,8 +53,8 @@ public function createProvider(): iterable
5853
];
5954

6055
yield [
61-
new Dsn('sendinblue+smtps', 'default', self::USER, self::PASSWORD),
62-
new SendinblueSmtpsTransport(self::USER, self::PASSWORD, $this->getDispatcher(), $this->getLogger()),
56+
new Dsn('sendinblue+smtp', 'default', self::USER, self::PASSWORD, 465),
57+
new SendinblueSmtpTransport(self::USER, self::PASSWORD, $this->getDispatcher(), $this->getLogger()),
6358
];
6459

6560
yield [
@@ -72,7 +67,7 @@ public function unsupportedSchemeProvider(): iterable
7267
{
7368
yield [
7469
new Dsn('sendinblue+foo', 'default', self::USER, self::PASSWORD),
75-
'The "sendinblue+foo" scheme is not supported; supported schemes for mailer "sendinblue" are: "sendinblue", "sendinblue+smtp", "sendinblue+smtps", "sendinblue+api".',
70+
'The "sendinblue+foo" scheme is not supported; supported schemes for mailer "sendinblue" are: "sendinblue", "sendinblue+smtp", "sendinblue+api".',
7671
];
7772
}
7873

src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueSmtpTransport.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ final class SendinblueSmtpTransport extends EsmtpTransport
2626

2727
public function __construct(string $username, string $password, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
2828
{
29-
parent::__construct(
30-
self::SENDINBLUE_SMTP_HOST,
31-
self::SENDINBLUE_SMTP_PORT,
32-
self::SENDINBLUE_TLS_ENABLED,
33-
$dispatcher,
34-
$logger
35-
);
29+
parent::__construct(self::SENDINBLUE_SMTP_HOST, self::SENDINBLUE_SMTP_PORT, self::SENDINBLUE_TLS_ENABLED, $dispatcher, $logger);
3630

3731
$this->setUsername($username);
3832
$this->setPassword($password);

src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueSmtpsTransport.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/Symfony/Component/Mailer/Bridge/Sendinblue/Transport/SendinblueTransportFactory.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
final class SendinblueTransportFactory extends AbstractTransportFactory
2323
{
24-
/**
25-
* {@inheritdoc}
26-
*/
2724
public function create(Dsn $dsn): TransportInterface
2825
{
2926
if (!\in_array($dsn->getScheme(), $this->getSupportedSchemes(), true)) {
@@ -36,29 +33,18 @@ public function create(Dsn $dsn): TransportInterface
3633
case 'sendinblue+smtp':
3734
$transport = SendinblueSmtpTransport::class;
3835
break;
39-
case 'sendinblue+smtps':
40-
$transport = SendinblueSmtpsTransport::class;
41-
break;
4236
case 'sendinblue+api':
4337
return (new SendinblueApiTransport($this->getUser($dsn), $this->client, $this->dispatcher, $this->logger))
4438
->setHost('default' === $dsn->getHost() ? null : $dsn->getHost())
4539
->setPort($dsn->getPort())
4640
;
4741
}
4842

49-
return new $transport(
50-
$this->getUser($dsn),
51-
$this->getPassword($dsn),
52-
$this->dispatcher,
53-
$this->logger
54-
);
43+
return new $transport($this->getUser($dsn), $this->getPassword($dsn), $this->dispatcher, $this->logger);
5544
}
5645

57-
/**
58-
* {@inheritdoc}
59-
*/
6046
protected function getSupportedSchemes(): array
6147
{
62-
return ['sendinblue', 'sendinblue+smtp', 'sendinblue+smtps', 'sendinblue+api'];
48+
return ['sendinblue', 'sendinblue+smtp', 'sendinblue+api'];
6349
}
6450
}

src/Symfony/Component/Mailer/Bridge/Sendinblue/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20-
"symfony/mailer": "^4.4|^5.0"
20+
"symfony/mailer": "^5.1"
2121
},
2222
"require-dev": {
2323
"symfony/http-client": "^4.4|^5.0"

src/Symfony/Component/Mailer/Exception/UnsupportedSchemeException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class UnsupportedSchemeException extends LogicException
4848
'class' => Bridge\Mailjet\Transport\MailjetTransportFactory::class,
4949
'package' => 'symfony/mailjet-mailer',
5050
],
51+
'sendinblue' => [
52+
'class' => Bridge\Sendinblue\Transport\SendinblueTransportFactory::class,
53+
'package' => 'symfony/sendinblue-mailer',
54+
],
5155
];
5256

5357
public function __construct(Dsn $dsn, string $name = null, array $supported = [])

src/Symfony/Component/Mailer/Transport.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory;
2020
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
2121
use Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory;
22+
use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
2223
use Symfony\Component\Mailer\Exception\InvalidArgumentException;
2324
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
2425
use Symfony\Component\Mailer\Transport\Dsn;
@@ -48,6 +49,7 @@ class Transport
4849
PostmarkTransportFactory::class,
4950
SendgridTransportFactory::class,
5051
MailjetTransportFactory::class,
52+
SendinblueTransportFactory::class,
5153
];
5254

5355
private $factories;

0 commit comments

Comments
 (0)
0