Skip to content

Commit

Permalink
Formatting Code
Browse files Browse the repository at this point in the history
  • Loading branch information
ugljesaspx committed May 31, 2024
1 parent af54526 commit 378dc83
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Console/Command/NostoClearQueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Nosto\Tagging\Console\Command;

use Exception;
use Magento\Framework\Amqp\Config;
use Magento\Framework\App\ResourceConnection;
use Nosto\NostoException;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -23,12 +25,12 @@ class NostoClearQueueCommand extends Command
/**
* @var Config
*/
private $amqpConfig;
private Config $amqpConfig;

Check warning on line 28 in Console/Command/NostoClearQueueCommand.php

View workflow job for this annotation

GitHub Actions / Phan Analysis

Property \Nosto\Tagging\Console\Command\NostoClearQueueCommand->amqpConfig has undeclared type \Magento\Framework\Amqp\Config (Did you mean class \Nosto\Tagging\Block\Adminhtml\Account\Config)

/**
* @var ResourceConnection
*/
private $resourceConnection;
private ResourceConnection $resourceConnection;

public function __construct(
ResourceConnection $resourceConnection,
Expand Down Expand Up @@ -96,7 +98,7 @@ private function clearDBQueues(string $topicName, SymfonyStyle $io): void
$this->clearQueueMessages($topicName, $connection);
$this->clearRelatedRecords($topicName, $connection);
$connection->commit();
} catch (\Exception $exception) {
} catch (Exception $exception) {
$connection->rollBack();
$io->error('An error occurred while clearing DB queues for topic '
. $topicName . ': '
Expand Down Expand Up @@ -176,10 +178,10 @@ private function clearRabbitMQQueue(string $queueName, SymfonyStyle $io): void
if ($this->queueExists($channel, $queueName)) {
$channel->queue_purge($queueName);
}
} catch (\Exception $e) {
} catch (Exception $e) {
// Log the error or handle it as required.
$io->error('An error occurred while clearing RabbitMQ queue ' . $queueName . ': ' . $e->getMessage());
throw new \RuntimeException('Failed to clear RabbitMQ queue: ' . $e->getMessage());
throw new RuntimeException('Failed to clear RabbitMQ queue: ' . $e->getMessage());
}
}

Expand Down

0 comments on commit 378dc83

Please sign in to comment.