8000 minor #60047 [Mailer] fix compatibility with TwigBridge < 7.3 (xabbuh) · symfony/symfony@b5b0cbf · GitHub
[go: up one dir, main page]

Skip to content

Commit b5b0cbf

Browse files
committed
minor #60047 [Mailer] fix compatibility with TwigBridge < 7.3 (xabbuh)
This PR was merged into the 7.3 branch. Discussion ---------- [Mailer] fix compatibility with TwigBridge < 7.3 | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 6ce7ec5 fix compatibility with TwigBridge < 7.3
2 parents f67a1ce + 6ce7ec5 commit b5b0cbf

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/Symfony/Component/Mailer/EventListener/MessageListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function setHeaders(Message $message): void
122122

123123
private function translateSubject(Message $message): void
124124
{
125-
if (!$message instanceof TemplatedEmail || !$this->translator || !$message->getTranslatableSubject() instanceof TranslatableMessage) {
125+
if (!$message instanceof TemplatedEmail || !$this->translator || !method_exists(TemplatedEmail::class, 'getTranslatableSubject') || !$message->getTranslatableSubject() instanceof TranslatableMessage) {
126126
return;
127127
}
128128

src/Symfony/Component/Mailer/Tests/EventListener/MessageListenerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ public static function provideHeaders(): iterable
120120

121121
public function testTranslatableSubject()
122122
{
123+
if (!method_exists(TemplatedEmail::class, 'getTranslatableSubject')) {
124+
$this->markTestSkipped('symfony/twig-bridge 7.3 or higher required');
125+
}
126+
123127
$message = new TemplatedEmail();
124128
$message->subject(new TranslatableMessage('hello.world'));
125129
$listener = new MessageListener(translator: new class implements TranslatorInterface {

src/Symfony/Component/Mailer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"psr/event-dispatcher": "^1",
2222
"psr/log": "^1|^2|^3",
2323
"symfony/event-dispatcher": "^6.4|^7.0",
24-
"symfony/mime": "^7.3",
24+
"symfony/mime": "^7.2",
2525
"symfony/service-contracts": "^2.5|^3"
2626
},
2727
"require-dev": {

0 commit comments

Comments
 (0)
0