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 c8725bf

Browse filesBrowse files
committed
feature #35167 [Notifier] Remove superfluous parameters in *Message::fromNotification() (fancyweb)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Notifier] Remove superfluous parameters in *Message::fromNotification() | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Those classes are final so I think we don't need those extra arguments. Commits ------- d0dacf5 [Notifier] Remove superfluous parameters in *Message::fromNotification()
2 parents 9b69b08 + d0dacf5 commit c8725bf
Copy full SHA for c8725bf

File tree

9 files changed

+23
-9
lines changed
Filter options

9 files changed

+23
-9
lines changed

‎UPGRADE-5.1.md

Copy file name to clipboardExpand all lines: UPGRADE-5.1.md
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ Messenger
3737
* Deprecated RedisExt transport. It has moved to a separate package. Run `composer require symfony/redis-messenger` to use the new classes.
3838
* Deprecated use of invalid options in Redis and AMQP connections.
3939

40+
Notifier
41+
--------
42+
43+
* [BC BREAK] The `ChatMessage::fromNotification()` method's `$recipient` and `$transport`
44+
arguments were removed.
45+
* [BC BREAK] The `EmailMessage::fromNotification()` and `SmsMessage::fromNotification()`
46+
methods' `$transport` argument was removed.
47+
4048
Routing
4149
-------
4250

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Slack/Tests/SlackTransportTest.php
+1-2Lines changed: 1 addition & 2 deletions
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;
2524
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Slack/composer.json
+1-1Lines 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"
21+
"symfony/notifier": "^5.1"
2222
},
2323
"require-dev": {
2424
"symfony/event-dispatcher": "^4.3|^5.0"

‎src/Symfony/Component/Notifier/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
=========
33

4+
5.1.0
5+
-----
6+
7+
* [BC BREAK] The `ChatMessage::fromNotification()` method's `$recipient` and `$transport`
8+
arguments were removed.
9+
* [BC BREAK] The `EmailMessage::fromNotification()` and `SmsMessage::fromNotification()`
10+
methods' `$transport` argument was removed.
11+
412
5.0.0
513
-----
614

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Channel/ChatChannel.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Channel/SmsChannel.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Message/ChatMessage.php
+1-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Message/EmailMessage.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Message/SmsMessage.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ 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) {
4040
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));

0 commit comments

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