Skip to content

Commit 33850c7

Browse files
fix: cli commands compatibility with Magento 2.4.6+
1 parent 766aff2 commit 33850c7

3 files changed

Lines changed: 36 additions & 9 deletions

File tree

Console/Command/Clear.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Clear extends Command
2929
/** @var ProgressBarFactory */
3030
private $progressBarFactory;
3131

32+
// phpcs:ignore
3233
public function __construct(
3334
ConfirmationQuestionFactory $confirmationQuestionFactory,
3435
CoreHelper $coreHelper,
@@ -45,7 +46,9 @@ public function __construct(
4546
$this->progressBarFactory = $progressBarFactory;
4647
}
4748

48-
/** @inheritDoc */
49+
/**
50+
* @inheritDoc
51+
*/
4952
protected function configure()
5053
{
5154
$this->setName('discorgento:queue:clear');
@@ -54,14 +57,18 @@ protected function configure()
5457
parent::configure();
5558
}
5659

57-
/** @inheritDoc */
60+
/**
61+
* @inheritDoc
62+
*/
5863
protected function execute(InputInterface $input, OutputInterface $output)
5964
{
6065
$messages = $this->messagesCollectionFactory->create();
6166

6267
$totalMessages = $messages->getSize();
6368
if ($totalMessages < 1) {
64-
return $output->writeln("<error>There's no pending jobs.</error>");
69+
$output->writeln("<error>There's no pending jobs.</error>");
70+
71+
return self::SUCCESS;
6572
}
6673

6774
if ($this->coreHelper->isProductionMode()) {
@@ -89,5 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8996
}
9097

9198
$output->writeln(PHP_EOL . '<info>Done.</info>');
99+
100+
return self::SUCCESS;
92101
}
93102
}

Console/Command/Execute.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Execute extends Command
1717
/** @var ProgressBarFactory */
1818
private $progressBarFactory;
1919

20+
// phpcs:ignore
2021
public function __construct(
2122
MessageManagementInterface $messageManagement,
2223
ProgressBarFactory $progressBarFactory,
@@ -27,7 +28,9 @@ public function __construct(
2728
$this->progressBarFactory = $progressBarFactory;
2829
}
2930

30-
/** @inheritDoc */
31+
/**
32+
* @inheritDoc
33+
*/
3134
protected function configure()
3235
{
3336
$this->setName('discorgento:queue:execute');
@@ -36,14 +39,18 @@ protected function configure()
3639
parent::configure();
3740
}
3841

39-
/** @inheritDoc */
42+
/**
43+
* @inheritDoc
44+
*/
4045
protected function execute(InputInterface $input, OutputInterface $output)
4146
{
4247
$pendingMessages = $this->messageManagement->getPending();
4348

4449
$totalMessages = $pendingMessages->getTotalCount();
4550
if ($totalMessages < 1) {
46-
return $output->writeln("There's no pending jobs.");
51+
$output->writeln("There's no pending jobs.");
52+
53+
return self::SUCCESS;
4754
}
4855

4956
$output->writeln('Executing the jobs in queue..');
@@ -62,5 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6269

6370
$progressBar->finish();
6471
$output->writeln(PHP_EOL . '<info>Done.</info>');
72+
73+
return self::SUCCESS;
6574
}
6675
}

Console/Command/Retry.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Retry extends Command
1717
/** @var ProgressBarFactory */
1818
private $progressBarFactory;
1919

20+
// phpcs:ignore
2021
public function __construct(
2122
MessageManagementInterface $messageManagement,
2223
ProgressBarFactory $progressBarFactory,
@@ -27,7 +28,9 @@ public function __construct(
2728
$this->progressBarFactory = $progressBarFactory;
2829
}
2930

30-
/** @inheritDoc */
31+
/**
32+
* @inheritDoc
33+
*/
3134
protected function configure()
3235
{
3336
$this->setName('discorgento:queue:retry');
@@ -36,14 +39,18 @@ protected function configure()
3639
parent::configure();
3740
}
3841

39-
/** @inheritDoc */
42+
/**
43+
* @inheritDoc
44+
*/
4045
protected function execute(InputInterface $input, OutputInterface $output)
4146
{
4247
$failedJobs = $this->messageManagement->getToBeRetried();
4348

4449
$totalMessages = count($failedJobs);
4550
if ($totalMessages < 1) {
46-
return $output->writeln("There's no jobs waiting to be retried.");
51+
$output->writeln("There's no jobs waiting to be retried.");
52+
53+
return self::SUCCESS;
4754
}
4855

4956
$output->writeln('Retrying the failed jobs..');
@@ -61,5 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6168

6269
$progressBar->finish();
6370
$output->writeln(PHP_EOL . '<info>Done.</info>');
71+
72+
return self::SUCCESS;
6473
}
6574
}

0 commit comments

Comments
 (0)