8000 feature #51245 [Scheduler] Only use toString if defined for message (… · symfony/symfony@20cefc8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 20cefc8

Browse files
committed
feature #51245 [Scheduler] Only use toString if defined for message (fabpot)
This PR was merged into the 6.4 branch. Discussion ---------- [Scheduler] Only use toString if defined for message | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a If the message is stringable, let's only use that instead of having the class name and the message as string (more flexible). For the trigger, it's always stringable anyway. Commits ------- 9d2ca60 [Scheduler] Only use toString if defined for message
2 parents f956606 + 9d2ca60 commit 20cefc8

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/Symfony/Component/Scheduler/Command/DebugCommand.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,10 @@ private static function renderRecurringMessage(RecurringMessage $recurringMessag
113113
$message = $message->getMessage();
114114
}
115115

116-
$messageName = (new \ReflectionClass($message))->getShortName();
117-
$triggerName = (new \ReflectionClass($trigger))->getShortName();
118-
119-
if ($message instanceof \Stringable) {
120-
$messageName .= ": {$message}";
121-
}
122-
123-
if ($trigger instanceof \Stringable) {
124-
$triggerName .= ": {$trigger}";
125-
}
126-
127116
return [
128-
$messageName,
129-
$triggerName,
130-
$recurringMessage->getTrigger()->getNextRunDate($date)?->format(\DateTimeInterface::ATOM) ?? '-',
117+
$message instanc 508D eof \Stringable ? (string) $message : (new \ReflectionClass($message))->getShortName(),
118+
(string) $trigger,
119+
$trigger->getNextRunDate($date)?->format(\DateTimeInterface::ATOM) ?? '-',
131120
];
132121
}
133122
}

0 commit comments

Comments
 (0)
0