From 33d97c298f8ba65f8e59b096e62d254d7b7d32b8 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Mon, 16 Dec 2024 16:13:20 +0000 Subject: [PATCH] Widen support for symfony console 5.x, and implement backwards compatible (to PHP 7.1) signature --- composer.json | 2 +- src/Command/QueueCleanCommand.php | 4 +++- src/Command/QueueCommand.php | 4 +++- src/Command/QueueCountCommand.php | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 48e2979..b8d8a1c 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "phpunit/phpunit": "^6.5 | ^9.5", "squizlabs/php_codesniffer": "^3.5", - "symfony/console": "^2.7 || ^3.2" + "symfony/console": "^2.7 || ^3.2 || ^4.4 || ^5.0" }, "conflict": { "sebastian/comparator": "<1.2.3" diff --git a/src/Command/QueueCleanCommand.php b/src/Command/QueueCleanCommand.php index eec8647..bb7f2d6 100644 --- a/src/Command/QueueCleanCommand.php +++ b/src/Command/QueueCleanCommand.php @@ -28,9 +28,11 @@ protected function configure() ->setDescription('Cleans the SQS queue through purging.'); } - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $this->logger->info('Cleaning queue: '.$this->queue->getName()); $this->queue->clean(); + + return 0; } } diff --git a/src/Command/QueueCommand.php b/src/Command/QueueCommand.php index 3d3a4c7..7c39cf0 100644 --- a/src/Command/QueueCommand.php +++ b/src/Command/QueueCommand.php @@ -56,13 +56,15 @@ protected function configure() ->setDescription('Watches SQS for changes.'); } - final public function execute(InputInterface $input, OutputInterface $output) + final public function execute(InputInterface $input, OutputInterface $output): int { $this->logger->info($this->getName().' Started listening.'); while (!$this->limit->hasBeenReached()) { $this->loop($input); } $this->logger->info($this->getName().' Stopped because of limits reached.'); + + return 0; } final protected function transform(QueueItem $item) diff --git a/src/Command/QueueCountCommand.php b/src/Command/QueueCountCommand.php index 30c4968..04a291f 100644 --- a/src/Command/QueueCountCommand.php +++ b/src/Command/QueueCountCommand.php @@ -25,8 +25,10 @@ protected function configure() ->setDescription('Counts the SQS messages, including invisible ones. Approximate.'); } - public function execute(InputInterface $input, OutputInterface $output) + public function execute(InputInterface $input, OutputInterface $output): int { $output->writeln($this->queue->count()); + + return 0; } }