Skip to content
Merged
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
11 changes: 10 additions & 1 deletion src/Command/RunTemplateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ protected function parseConfigOptions(InputInterface $input): array
return $result;
}

/**
* Handle the "runtemplate" CLI command performing actions such as list, get, create, update, delete, and schedule, and emit results to the provided output.
*
* Supports resolving company slugs/IDs, resolving app UUIDs, applying command-line config overrides, and formatting output as JSON or text.
*
* @param InputInterface $input Console input containing the action argument and command options.
* @param OutputInterface $output Console output used for writing messages and serialized results.
* @return int One of MultiFlexiCommand::SUCCESS or MultiFlexiCommand::FAILURE indicating the command outcome.
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$format = strtolower($input->getOption('format'));
Expand Down Expand Up @@ -565,7 +574,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$isImmediate = ($scheduleDateTime->getTimestamp() <= $now->getTimestamp() + 5); // 5 sec tolerance
$scheduleType = $isImmediate ? 'adhoc' : 'cli';

$prepared = $jobber->prepareJob($rt->getMyKey(), $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
$prepared = $jobber->prepareJob($rt, $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
// scheduleJobRun() is now called automatically inside prepareJob()
Comment on lines +577 to 578
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Correct fix, but remove unused variable assignment.

The fix correctly passes the RunTemplate object instead of its integer key, resolving the TypeError. However, the $prepared variable is assigned but never used.

🧹 Proposed fix to remove unused variable
-                    $prepared = $jobber->prepareJob($rt, $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
+                    $jobber->prepareJob($rt, $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$prepared = $jobber->prepareJob($rt, $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
// scheduleJobRun() is now called automatically inside prepareJob()
$jobber->prepareJob($rt, $overridedEnv, $scheduleDateTime, $executor, $scheduleType);
// scheduleJobRun() is now called automatically inside prepareJob()
🧰 Tools
🪛 PHPMD (2.15.0)

[warning] 577-577: Avoid unused local variables such as '$prepared'. (undefined)

(UnusedLocalVariable)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Command/RunTemplateCommand.php` around lines 577 - 578, The assignment to
$prepared is unused — call prepareJob with the RunTemplate ($rt) and other args
without assigning its return value; remove the unused $prepared variable and
keep the existing call to $jobber->prepareJob($rt, $overridedEnv,
$scheduleDateTime, $executor, $scheduleType) (note: scheduleJobRun() is invoked
inside prepareJob()).


if ($format === 'json') {
Expand Down
Loading