Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Entity/BaseScheduledCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ public function getNextRunDate(bool $checkExecuteImmediately = true): ?DateTime
return (new CronExpressionLib($this->getCronExpression()))->getNextRunDate();
}

public function getCronExpressionTranslated(): string
public function getCronExpressionTranslated(string $locale = 'en', bool $timeFormat24hours = false): string
{
try {
return CronTranslator::translate($this->getCronExpression());
return CronTranslator::translate($this->getCronExpression(), $locale, $timeFormat24hours);
} catch (\Exception $e) {
return 'error: could not translate cron expression';
}
Expand Down
2 changes: 1 addition & 1 deletion Entity/ScheduledCommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function setNotes(string $notes): static;

public function getNextRunDate(bool $checkExecuteImmediately = true): ?DateTime;

public function getCronExpressionTranslated(): string;
public function getCronExpressionTranslated(string $locale = 'en', bool $timeFormat24hours = false): string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all classes implementing ScheduledCommandInterface
echo "=== Implementations of ScheduledCommandInterface ==="
rg -n 'implements\s+ScheduledCommandInterface' --type=php

echo ""
echo "=== Classes extending BaseScheduledCommand ==="
rg -n 'extends\s+BaseScheduledCommand' --type=php

Repository: Dukecity/CommandSchedulerBundle

Length of output: 475


🌐 Web query:

lorisleiva/cron-translator version 0.5.0 translate method signature API

💡 Result:

I couldn’t find any lorisleiva/cron-translator v0.5.0 release/tag on Packagist or in the GitHub releases list (latest shown there is v0.4.6, released June 25, 2025). [1]

For the currently documented API, CronTranslator::translate is a static method that takes:

CronTranslator::translate(string $expression, string $locale = 'en', bool $use24HourTime = false): string
  • 1st arg: cron expression
  • 2nd arg (optional): locale (e.g. 'fr')
  • 3rd arg (optional): use 24-hour time formatting (true/false) [2]

Sources: [1] [2]


🏁 Script executed:

#!/bin/bash
# Check the actual CronTranslator call in BaseScheduledCommand
echo "=== BaseScheduledCommand getCronExpressionTranslated implementation ==="
sed -n '320,340p' Entity/BaseScheduledCommand.php

echo ""
echo "=== Composer dependency for cron-translator ==="
rg -A2 -B2 'cron-translator' composer.json

Repository: Dukecity/CommandSchedulerBundle

Length of output: 994


Dependency version constraint ^0.5.0 for lorisleiva/cron-translator does not exist and will cause composer to fail.

The interface signature change itself is correct and consistent with BaseScheduledCommand, which properly forwards the new optional parameters to CronTranslator::translate(). The parameter order (expression, locale, use24HourTime) matches the library's API.

However, composer.json specifies "lorisleiva/cron-translator": "^0.5.0", but v0.5.0 has never been released. The latest available version is v0.4.6 (June 25, 2025). The constraint ^0.5.0 must be corrected to ^0.4.6 or higher if a newer version becomes available.

No other implementations of ScheduledCommandInterface exist in the codebase that require updating — only BaseScheduledCommand implements it, and its signature already matches.

🤖 Prompt for AI Agents
In `@Entity/ScheduledCommandInterface.php` at line 89, Update the composer
constraint for lorisleiva/cron-translator so Composer can install it: replace
the non-existent "^0.5.0" constraint with a valid released version (e.g.
"^0.4.6") in composer.json, then run composer update; the interface method
getCronExpressionTranslated(string $locale = 'en', bool $timeFormat24hours =
false) and BaseScheduledCommand already match the library API so no other code
changes are needed.


public function __toString(): string;
}
2 changes: 1 addition & 1 deletion Resources/views/List/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{{ command.command }} {{ command.arguments }}
</td>
<td>
<span title="{{ command.getCronExpressionTranslated() }}">{{ command.cronExpression }}</span>
<span title="{{ command.getCronExpressionTranslated(app.request.locale) }}">{{ command.cronExpression }}</span>
</td>
<td>
{{ command.logFile }}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"doctrine/persistence": "^3.4.1 || ^4.1",
"dragonmantank/cron-expression": "^3.6",
"knplabs/knp-time-bundle": "^2.4",
"lorisleiva/cron-translator": "^0.5",
"lorisleiva/cron-translator": "^0.5.0",
"symfony/asset": "^7.4 || ^8.0",
"symfony/config": "^7.4 || ^8.0",
"symfony/console": "^7.4 || ^8.0",
Expand Down