8000 [Notifier] Remove superfluous parameters in *Message::fromNotification() · symfony/symfony@98d24d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98d24d9

Browse files
committed
[Notifier] Remove superfluous parameters in *Message::fromNotification()
1 parent f35935f commit 98d24d9

File tree

7 files changed

+8
-10
lines changed

7 files changed

+8
-10
lines changed

src/Symfony/Component/Notifier/Bridge/Slack/Tests/SlackTransportTest.php

Lines changed: 1 addition & 2 deletions
< 10000 td data-grid-cell-id="diff-8bbac5a173d455e4e0f2d5bcdc99c319fd23794496600b585fa164df9469b598-25-24-0" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">25
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\Notifier\Message\MessageInterface;
2222
use Symfony\Component\Notifier\Message\MessageOptionsInterface;
2323
use Symfony\Component\Notifier\Notification\Notification;
24-
use Symfony\Component\Notifier\Recipient\Recipient;
24
use Symfony\Contracts\HttpClient\HttpClientInterface;
2625
use Symfony\Contracts\HttpClient\ResponseInterface;
2726

@@ -145,7 +144,7 @@ public function testSendWithNotification(): void
145144
->willReturn(json_encode(['ok' => true]));
146145

147146
$notification = new Notification($message);
148-
$chatMessage = ChatMessage::fromNotification($notification, new Recipient('test-email@example.com'));
147+
$chatMessage = ChatMessage::fromNotification($notification);
149148
$options = SlackOptions::fromNotification($notification);
150149

151150
$expectedBody = http_build_query([

src/Symfony/Component/Notifier/Bridge/Slack/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^7.2.5",
2020
"symfony/http-client": "^4.3|^5.0",
21-
"symfony/notifier": "~5.0.0"
21+
"symfony/notifier": "~5.0.3"
2222
},
2323
"require-dev": {
2424
"symfony/event-dispatcher": "^4.3|^5.0"

src/Symfony/Component/Notifier/Channel/ChatChannel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function notify(Notification $notification, Recipient $recipient, string
3636
}
3737

3838
if (null === $message) {
39-
$message = ChatMessage::fromNotification($notification, $recipient, $transportName);
39+
$message = ChatMessage::fromNotification($notification);
4040
}
4141

4242
$message->transport($transportName);

src/Symfony/Component/Notifier/Channel/SmsChannel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function notify(Notification $notification, Recipient $recipient, string
3232
}
3333

3434
if (null === $message) {
35-
$message = SmsMessage::fromNotification($notification, $recipient, $transportName);
35+
$message = SmsMessage::fromNotification($notification, $recipient);
3636
}
3737

3838
if (null !== $transportName) {

src/Symfony/Component/Notifier/Message/ChatMessage.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Notifier\Message;
1313

1414
use Symfony\Component\Notifier\Notification\Notification;
15-
use Symfony\Component\Notifier\Recipient\Recipient;
1615

1716
/**
1817
* @author Fabien Potencier <fabien@symfony.com>
@@ -32,7 +31,7 @@ public function __construct(string $subject, MessageOptionsInterface $options =
3231
$this->options = $options;
3332
}
3433

35-
public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
34+
public static function fromNotification(Notification $notification): self
3635
{
3736
$message = new self($notification->getSubject());
3837
$message->notification = $notification;

src/Symfony/Component/Notifier/Message/EmailMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(RawMessage $message, Envelope $envelope = null)
3535
$this->envelope = $envelope;
3636
}
3737

38-
public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
38+
public static function fromNotification(Notification $notification, Recipient $recipient): self
3939
{
4040
if (!class_exists(NotificationEmail::class)) {
4141
$email = (new Email())

src/Symfony/Component/Notifier/Message/SmsMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function __construct(string $phone, string $subject)
3434
$this->phone = $phone;
3535
}
3636

37-
public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
37+
public static function fromNotification(Notification $notification, Recipient $recipient): self
3838
{
3939
if (!$recipient instanceof SmsRecipientInterface) {
40-
throw new LogicException(sprintf('To send a SMS message, "%s" should implement "%s" or the recipient should implement "%s".', get_class($notification), SmsNotificationInterface::class, SmsRecipientInterface::class));
40+
throw new LogicException(sprintf('To send a SMS message, "%s" should implement "%s" or the recipient should implement "%s".', \get_class($notification), SmsNotificationInterface::class, SmsRecipientInterface::class));
4141
}
4242

4343
return new self($recipient->getPhone(), $notification->getSubject());

0 commit comments

Comments
 (0)
0