Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b968497

Browse files
committed
bug #37748 [Notifier] Fix SentMessage implementation (fabpot)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Notifier] Fix SentMessage implementation | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | n/a #36611 broke the Notifier when used with Messenger. /cc @jeremyFreeAgent Commits ------- 92c28de [Notifier] Fix SentMessage implementation
2 parents 9db0f20 + 92c28de commit b968497

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

src/Symfony/Component/Notifier/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
5.2.0
55
-----
66

7-
* [BC BREAK] The `TransportInterface::send()` and `AbstractTransport::doSend()` methods changed to return a `SentMessage` instance instead of `void`.
7+
* [BC BREAK] The `TransportInterface::send()` and `AbstractTransport::doSend()` methods changed to return a `?SentMessage` instance instead of `void`.
88

99
5.1.0
1010
-----

src/Symfony/Component/Notifier/Chatter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ public function supports(MessageInterface $message): bool
4848
return $this->transport->supports($message);
4949
}
5050

51-
public function send(MessageInterface $message): SentMessage
51+
public function send(MessageInterface $message): ?SentMessage
5252
{
5353
if (null === $this->bus) {
54-
return $this->transport->send($message);
54+
$this->transport->send($message);
55+
56+
return null;
5557
}
5658

5759
if (null !== $this->dispatcher) {
5860
$this->dispatcher->dispatch(new MessageEvent($message, true));
5961
}
6062

6163
$this->bus->dispatch($message);
64+
65+
return null;
6266
}
6367
}

src/Symfony/Component/Notifier/Texter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@ public function supports(MessageInterface $message): bool
4848
return $this->transport->supports($message);
4949
}
5050

51-
public function send(MessageInterface $message): SentMessage
51+
public function send(MessageInterface $message): ?SentMessage
5252
{
5353
if (null === $this->bus) {
54-
return $this->transport->send($message);
54+
$this->transport->send($message);
55+
56+
return null;
5557
}
5658

5759
if (null !== $this->dispatcher) {
5860
$this->dispatcher->dispatch(new MessageEvent($message, true));
5961
}
6062

6163
$this->bus->dispatch($message);
64+
65+
return null;
6266
}
6367
}

src/Symfony/Component/Notifier/Transport/TransportInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface TransportInterface
2525
/**
2626
* @throws TransportExceptionInterface
2727
*/
28-
public function send(MessageInterface $message): SentMessage;
28+
public function send(MessageInterface $message): ?SentMessage;
2929

3030
public function supports(MessageInterface $message): bool;
3131

0 commit comments

Comments
 (0)