File tree Expand file tree Collapse file tree 6 files changed +11
-4
lines changed
src/Symfony/Component/Notifier Expand file tree Collapse file tree 6 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public function getOptions(): ?MessageOptionsInterface
7777 /**
7878 * @return $this
7979 */
80- public function transport (?string $ transport ): self
80+ public function transport (?string $ transport ): MessageInterface
8181 {
8282 $ this ->transport = $ transport ;
8383
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public function getOptions(): ?MessageOptionsInterface
102102 /**
103103 * @return $this
104104 */
105- public function transport (string $ transport ): self
105+ public function transport (string $ transport ): MessageInterface
106106 {
107107 if (!$ this ->message instanceof Email) {
108108 throw new LogicException ('Cannot set a Transport on a RawMessage instance. ' );
Original file line number Diff line number Diff line change @@ -25,4 +25,6 @@ public function getSubject(): string;
2525 public function getOptions (): ?MessageOptionsInterface ;
2626
2727 public function getTransport (): ?string ;
28+
29+ public function transport (string $ transport ): MessageInterface ;
2830}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function getSubject(): string
8383 /**
8484 * @return $this
8585 */
86- public function transport (string $ transport ): self
86+ public function transport (string $ transport ): MessageInterface
8787 {
8888 $ this ->transport = $ transport ;
8989
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ public function __construct(EventDispatcherInterface $dispatcher = null)
3434
3535 public function send (MessageInterface $ message ): SentMessage
3636 {
37+ if (null === $ message ->getTransport ()) {
38+ $ message ->transport ((string ) $ this );
39+ }
40+
3741 if (null !== $ this ->dispatcher ) {
3842 $ this ->dispatcher ->dispatch (new MessageEvent ($ message ));
3943 }
Original file line number Diff line number Diff line change @@ -55,8 +55,9 @@ public function supports(MessageInterface $message): bool
5555 public function send (MessageInterface $ message ): SentMessage
5656 {
5757 if (!$ transport = $ message ->getTransport ()) {
58- foreach ($ this ->transports as $ transport ) {
58+ foreach ($ this ->transports as $ transportName => $ transport ) {
5959 if ($ transport ->supports ($ message )) {
60+ $ message ->transport ($ transportName );
6061 return $ transport ->send ($ message );
6162 }
6263 }
You can’t perform that action at this time.
0 commit comments