Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fa39cd6

Browse filesBrowse files
committed
[Notifier] UnsupportedMessageTypeException for notifier transports
1 parent fda67f5 commit fa39cd6
Copy full SHA for fa39cd6

28 files changed

+95
-46
lines changed

‎src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Notifier\Exception\LogicException;
1515
use Symfony\Component\Notifier\Exception\TransportException;
16+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1617
use Symfony\Component\Notifier\Message\ChatMessage;
1718
use Symfony\Component\Notifier\Message\MessageInterface;
1819
use Symfony\Component\Notifier\Message\SentMessage;
@@ -59,7 +60,7 @@ public function supports(MessageInterface $message): bool
5960
protected function doSend(MessageInterface $message): SentMessage
6061
{
6162
if (!$message instanceof ChatMessage) {
62-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
63+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
6364
}
6465

6566
$messageOptions = $message->getOptions();

‎src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\MockHttpClient;
1616
use Symfony\Component\Notifier\Bridge\Discord\DiscordTransport;
17-
use Symfony\Component\Notifier\Exception\LogicException;
1817
use Symfony\Component\Notifier\Exception\TransportException;
18+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1919
use Symfony\Component\Notifier\Message\ChatMessage;
2020
use Symfony\Component\Notifier\Message\MessageInterface;
2121
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -43,9 +43,10 @@ public function testSupportsChatMessage()
4343

4444
public function testSendNonChatMessageThrows()
4545
{
46-
$this->expectException(LogicException::class);
4746
$transport = new DiscordTransport('testToken', 'testChannel', $this->createMock(HttpClientInterface::class));
4847

48+
$this->expectException(UnsupportedMessageTypeException::class);
49+
4950
$transport->send($this->createMock(MessageInterface::class));
5051
}
5152

‎src/Symfony/Component/Notifier/Bridge/Esendex/EsendexTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Esendex/EsendexTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
use Symfony\Component\HttpClient\Exception\JsonException;
1515
use Symfony\Component\HttpClient\Exception\TransportException as HttpClientTransportException;
16-
use Symfony\Component\Notifier\Exception\LogicException;
1716
use Symfony\Component\Notifier\Exception\TransportException;
17+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1818
use Symfony\Component\Notifier\Message\MessageInterface;
1919
use Symfony\Component\Notifier\Message\SentMessage;
2020
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -55,7 +55,7 @@ public function supports(MessageInterface $message): bool
5555
protected function doSend(MessageInterface $message): SentMessage
5656
{
5757
if (!$message instanceof SmsMessage) {
58-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
58+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5959
}
6060

6161
$messageData = [

‎src/Symfony/Component/Notifier/Bridge/Esendex/Tests/EsendexTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Esendex/Tests/EsendexTransportTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\MockHttpClient;
1616
use Symfony\Component\Notifier\Bridge\Esendex\EsendexTransport;
17-
use Symfony\Component\Notifier\Exception\LogicException;
1817
use Symfony\Component\Notifier\Exception\TransportException;
18+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1919
use Symfony\Component\Notifier\Message\MessageInterface;
2020
use Symfony\Component\Notifier\Message\SmsMessage;
2121
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -43,7 +43,8 @@ public function testSendNonSmsMessageThrows(): void
4343
{
4444
$transport = new EsendexTransport('testToken', 'accountReference', 'from', $this->createMock(HttpClientInterface::class));
4545

46-
$this->expectException(LogicException::class);
46+
$this->expectException(UnsupportedMessageTypeException::class);
47+
4748
$transport->send($this->createMock(MessageInterface::class));
4849
}
4950

‎src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Notifier\Bridge\Firebase;
1313

1414
use Symfony\Component\Notifier\Exception\InvalidArgumentException;
15-
use Symfony\Component\Notifier\Exception\LogicException;
1615
use Symfony\Component\Notifier\Exception\TransportException;
16+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1717
use Symfony\Component\Notifier\Message\ChatMessage;
1818
use Symfony\Component\Notifier\Message\MessageInterface;
1919
use Symfony\Component\Notifier\Message\SentMessage;
@@ -54,7 +54,7 @@ public function supports(MessageInterface $message): bool
5454
protected function doSend(MessageInterface $message): SentMessage
5555
{
5656
if (!$message instanceof ChatMessage) {
57-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
57+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
5858
}
5959

6060
$endpoint = sprintf('https://%s', $this->getEndpoint());

‎src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\FreeMobile;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -55,7 +55,7 @@ public function supports(MessageInterface $message): bool
5555
protected function doSend(MessageInterface $message): SentMessage
5656
{
5757
if (!$this->supports($message)) {
58-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given) and configured with your phone number.', __CLASS__, SmsMessage::class, \get_class($message)));
58+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5959
}
6060

6161
$response = $this->client->request('POST', $this->getEndpoint(), [

‎src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Notifier\Bridge\FreeMobile\FreeMobileTransport;
16-
use Symfony\Component\Notifier\Exception\LogicException;
16+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1717
use Symfony\Component\Notifier\Message\MessageInterface;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
1919
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -46,7 +46,7 @@ public function testSendNonSmsMessageThrowsException(): void
4646
{
4747
$transport = $this->getTransport('0611223344');
4848

49-
$this->expectException(LogicException::class);
49+
$this->expectException(UnsupportedMessageTypeException::class);
5050

5151
$transport->send(new SmsMessage('0699887766', 'Hello!'));
5252
}

‎src/Symfony/Component/Notifier/Bridge/GoogleChat/GoogleChatTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GoogleChat/GoogleChatTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\HttpClient\Exception\JsonException;
1515
use Symfony\Component\Notifier\Exception\LogicException;
1616
use Symfony\Component\Notifier\Exception\TransportException;
17+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1718
use Symfony\Component\Notifier\Message\ChatMessage;
1819
use Symfony\Component\Notifier\Message\MessageInterface;
1920
use Symfony\Component\Notifier\Message\SentMessage;
@@ -89,7 +90,7 @@ public function supports(MessageInterface $message): bool
8990
protected function doSend(MessageInterface $message): SentMessage
9091
{
9192
if (!$message instanceof ChatMessage) {
92-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, \get_class($message)));
93+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
9394
}
9495
if ($message->getOptions() && !$message->getOptions() instanceof GoogleChatOptions) {
9596
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, GoogleChatOptions::class));

‎src/Symfony/Component/Notifier/Bridge/GoogleChat/Tests/GoogleChatTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GoogleChat/Tests/GoogleChatTransportTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\Notifier\Bridge\GoogleChat\GoogleChatTransport;
1818
use Symfony\Component\Notifier\Exception\LogicException;
1919
use Symfony\Component\Notifier\Exception\TransportException;
20+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
2021
use Symfony\Component\Notifier\Message\ChatMessage;
2122
use Symfony\Component\Notifier\Message\MessageInterface;
2223
use Symfony\Component\Notifier\Message\MessageOptionsInterface;
@@ -44,10 +45,10 @@ public function testSupportsChatMessage(): void
4445

4546
public function testSendNonChatMessageThrows(): void
4647
{
47-
$this->expectException(LogicException::class);
48-
4948
$transport = new GoogleChatTransport('My-Space', 'theAccessKey', 'theAccessToken=', $this->createMock(HttpClientInterface::class));
5049

50+
$this->expectException(UnsupportedMessageTypeException::class);
51+
5152
$transport->send($this->createMock(MessageInterface::class));
5253
}
5354

‎src/Symfony/Component/Notifier/Bridge/Infobip/InfobipTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Infobip/InfobipTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\Infobip;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -52,7 +52,7 @@ public function supports(MessageInterface $message): bool
5252
protected function doSend(MessageInterface $message): SentMessage
5353
{
5454
if (!$message instanceof SmsMessage) {
55-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
55+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5656
}
5757

5858
$endpoint = sprintf('https://%s/sms/2/text/advanced', $this->getEndpoint());

‎src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LinkedIn/LinkedInTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Notifier\Bridge\LinkedIn\Share\AuthorShare;
1515
use Symfony\Component\Notifier\Exception\LogicException;
1616
use Symfony\Component\Notifier\Exception\TransportException;
17+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1718
use Symfony\Component\Notifier\Message\ChatMessage;
1819
use Symfony\Component\Notifier\Message\MessageInterface;
1920
use Symfony\Component\Notifier\Message\SentMessage;
@@ -61,7 +62,7 @@ public function supports(MessageInterface $message): bool
6162
protected function doSend(MessageInterface $message): SentMessage
6263
{
6364
if (!$message instanceof ChatMessage) {
64-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, \get_class($message)));
65+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
6566
}
6667
if ($message->getOptions() && !$message->getOptions() instanceof LinkedInOptions) {
6768
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, LinkedInOptions::class));

‎src/Symfony/Component/Notifier/Bridge/LinkedIn/Tests/LinkedInTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LinkedIn/Tests/LinkedInTransportTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Symfony\Component\Notifier\Bridge\LinkedIn\LinkedInTransport;
88
use Symfony\Component\Notifier\Exception\LogicException;
99
use Symfony\Component\Notifier\Exception\TransportException;
10+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1011
use Symfony\Component\Notifier\Message\ChatMessage;
1112
use Symfony\Component\Notifier\Message\MessageInterface;
1213
use Symfony\Component\Notifier\Message\MessageOptionsInterface;
@@ -31,10 +32,10 @@ public function testSupportsChatMessage(): void
3132

3233
public function testSendNonChatMessageThrows(): void
3334
{
34-
$this->expectException(LogicException::class);
35-
3635
$transport = $this->getTransport();
3736

37+
$this->expectException(UnsupportedMessageTypeException::class);
38+
3839
$transport->send($this->createMock(MessageInterface::class));
3940
}
4041

‎src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\Mattermost;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\ChatMessage;
1717
use Symfony\Component\Notifier\Message\MessageInterface;
1818
use Symfony\Component\Notifier\Message\SentMessage;
@@ -54,7 +54,7 @@ public function supports(MessageInterface $message): bool
5454
protected function doSend(MessageInterface $message): SentMessage
5555
{
5656
if (!$message instanceof ChatMessage) {
57-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
57+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
5858
}
5959

6060
$endpoint = sprintf('https://%s/api/v4/posts', $this->getEndpoint());

‎src/Symfony/Component/Notifier/Bridge/Mobyt/MobytTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Mobyt/MobytTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Notifier\Exception\LogicException;
1515
use Symfony\Component\Notifier\Exception\TransportException;
16+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1617
use Symfony\Component\Notifier\Message\MessageInterface;
1718
use Symfony\Component\Notifier\Message\SentMessage;
1819
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -57,7 +58,7 @@ public function supports(MessageInterface $message): bool
5758
protected function doSend(MessageInterface $message): SentMessage
5859
{
5960
if (!$message instanceof SmsMessage) {
60-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, \get_class($message)));
61+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
6162
}
6263

6364
if ($message->getOptions() && !$message->getOptions() instanceof MobytOptions) {

‎src/Symfony/Component/Notifier/Bridge/Nexmo/NexmoTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Nexmo/NexmoTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\Nexmo;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -55,7 +55,7 @@ public function supports(MessageInterface $message): bool
5555
protected function doSend(MessageInterface $message): SentMessage
5656
{
5757
if (!$message instanceof SmsMessage) {
58-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
58+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5959
}
6060

6161
$response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/sms/json', [

‎src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\OvhCloud;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -57,7 +57,7 @@ public function supports(MessageInterface $message): bool
5757
protected function doSend(MessageInterface $message): SentMessage
5858
{
5959
if (!$message instanceof SmsMessage) {
60-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
60+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
6161
}
6262

6363
$endpoint = sprintf('https://%s/1.0/sms/%s/jobs', $this->getEndpoint(), $this->serviceName);

‎src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/RocketChat/RocketChatTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Notifier\Exception\LogicException;
1515
use Symfony\Component\Notifier\Exception\TransportException;
16+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1617
use Symfony\Component\Notifier\Message\ChatMessage;
1718
use Symfony\Component\Notifier\Message\MessageInterface;
1819
use Symfony\Component\Notifier\Message\SentMessage;
@@ -59,7 +60,7 @@ public function supports(MessageInterface $message): bool
5960
protected function doSend(MessageInterface $message): SentMessage
6061
{
6162
if (!$message instanceof ChatMessage) {
62-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, ChatMessage::class, get_debug_type($message)));
63+
throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::class, $message);
6364
}
6465
if ($message->getOptions() && !$message->getOptions() instanceof RocketChatOptions) {
6566
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, RocketChatOptions::class));

‎src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Sendinblue/SendinblueTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\Sendinblue;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -53,7 +53,7 @@ public function supports(MessageInterface $message): bool
5353
protected function doSend(MessageInterface $message): SentMessage
5454
{
5555
if (!$message instanceof SmsMessage) {
56-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
56+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5757
}
5858

5959
$response = $this->client->request('POST', 'https://'.$this->getEndpoint().'/v3/transactionalSMS/sms', [

‎src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Sendinblue/Tests/SendinblueTransportTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpClient\MockHttpClient;
1616
use Symfony\Component\Notifier\Bridge\Sendinblue\SendinblueTransport;
17-
use Symfony\Component\Notifier\Exception\LogicException;
1817
use Symfony\Component\Notifier\Exception\TransportException;
18+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1919
use Symfony\Component\Notifier\Message\MessageInterface;
2020
use Symfony\Component\Notifier\Message\SmsMessage;
2121
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -42,7 +42,8 @@ public function testSendNonSmsMessageThrowsException(): void
4242
{
4343
$transport = $this->initTransport();
4444

45-
$this->expectException(LogicException::class);
45+
$this->expectException(UnsupportedMessageTypeException::class);
46+
4647
$transport->send($this->createMock(MessageInterface::class));
4748
}
4849

‎src/Symfony/Component/Notifier/Bridge/Sinch/SinchTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Sinch/SinchTransport.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Notifier\Bridge\Sinch;
1313

14-
use Symfony\Component\Notifier\Exception\LogicException;
1514
use Symfony\Component\Notifier\Exception\TransportException;
15+
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1616
use Symfony\Component\Notifier\Message\MessageInterface;
1717
use Symfony\Component\Notifier\Message\SentMessage;
1818
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -55,7 +55,7 @@ public function supports(MessageInterface $message): bool
5555
protected function doSend(MessageInterface $message): SentMessage
5656
{
5757
if (!$message instanceof SmsMessage) {
58-
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" (instance of "%s" given).', __CLASS__, SmsMessage::class, get_debug_type($message)));
58+
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
5959
}
6060

6161
$endpoint = sprintf('https://%s/xms/v1/%s/batches', $this->getEndpoint(), $this->accountSid);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.