Skip to content

Commit 10b01dd

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

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function testSendWithNotification(): void
145145
->willReturn(json_encode(['ok' => true]));
146146

147147
$notification = new Notification($message);
148-
$chatMessage = ChatMessage::fromNotification($notification, new Recipient('test-email@example.com'));
148+
$chatMessage = ChatMessage::fromNotification($notification);
149149
$options = SlackOptions::fromNotification($notification);
150150

151151
$expectedBody = http_build_query([

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

+1-1
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(string $subject, MessageOptionsInterface $options =
3232
$this->options = $options;
3333
}
3434

35-
public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
35+
public static function fromNotification(Notification $notification): self
3636
{
3737
$message = new self($notification->getSubject());
3838
$message->notification = $notification;

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

+1-1
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

+2-2
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)