Skip to content

Commit

Permalink
Small typos and reformats
Browse files Browse the repository at this point in the history
  • Loading branch information
Radovan Kep谩k committed Jan 31, 2022
1 parent b63b780 commit f52b042
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 53 deletions.
6 changes: 3 additions & 3 deletions src/Client.php
Expand Up @@ -15,11 +15,11 @@
final class Client
{

public function __construct(private ProducerFactory $producerFactory)
{
public function __construct(
private ProducerFactory $producerFactory
) {
}


/**
* @throws ProducerFactoryException
*/
Expand Down
10 changes: 3 additions & 7 deletions src/Connection/ConnectionFactory.php
Expand Up @@ -19,12 +19,11 @@ final class ConnectionFactory
*/
private array $requests = [];


public function __construct(private ConnectionsDataBag $connectionsDataBag)
{
public function __construct(
private ConnectionsDataBag $connectionsDataBag
) {
}


/**
* @return IConnection[]
*/
Expand All @@ -33,7 +32,6 @@ public function getConnections(): array
return $this->connections;
}


/**
* @throws ConnectionFactoryException|\Exception
*/
Expand All @@ -46,7 +44,6 @@ public function getConnection(string $name): IConnection
return $this->connections[$name];
}


public function getApi(string $name): IApi
{
if (!isset($this->requests[$name])) {
Expand Down Expand Up @@ -84,7 +81,6 @@ private function createApi(string $name): Api
);
}


/**
* @throws ConnectionFactoryException|\Exception
*/
Expand Down
6 changes: 4 additions & 2 deletions src/Console/Command/AbstractConsumerCommand.php
Expand Up @@ -12,8 +12,10 @@
abstract class AbstractConsumerCommand extends Command
{

public function __construct(protected ConsumersDataBag $consumersDataBag, protected ConsumerFactory $consumerFactory)
{
public function __construct(
protected ConsumersDataBag $consumersDataBag,
protected ConsumerFactory $consumerFactory
) {
parent::__construct();
}

Expand Down
2 changes: 0 additions & 2 deletions src/Console/Command/StaticConsumerCommand.php
Expand Up @@ -20,7 +20,6 @@ protected function configure(): void
$this->addArgument('amountOfMessages', InputArgument::REQUIRED, 'Amount of messages to consume');
}


/**
* @throws \InvalidArgumentException
*/
Expand Down Expand Up @@ -48,7 +47,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 0;
}


/**
* @throws \InvalidArgumentException
*/
Expand Down
6 changes: 4 additions & 2 deletions src/Consumer/BulkMessage.php
Expand Up @@ -9,8 +9,10 @@

class BulkMessage
{
public function __construct(private Message $message, private Channel $channel)
{
public function __construct(
private Message $message,
private Channel $channel
) {
}

public function getMessage(): Message
Expand Down
3 changes: 0 additions & 3 deletions src/Consumer/Consumer.php
Expand Up @@ -21,7 +21,6 @@ class Consumer
protected int $messages = 0;
protected ?int $maxMessages = null;


public function __construct(
private LazyDeclarator $lazyDeclarator,
protected string $name,
Expand All @@ -33,13 +32,11 @@ public function __construct(
$this->callback = $callback;
}


public function getQueue(): IQueue
{
return $this->queue;
}


public function getCallback(): callable
{
return $this->callback;
Expand Down
3 changes: 0 additions & 3 deletions src/Consumer/ConsumerFactory.php
Expand Up @@ -15,15 +15,13 @@ final class ConsumerFactory
*/
private array $consumers = [];


public function __construct(
private ConsumersDataBag $consumersDataBag,
private QueueFactory $queueFactory,
private LazyDeclarator $lazyDeclarator,
) {
}


/**
* @throws ConsumerFactoryException
*/
Expand All @@ -36,7 +34,6 @@ public function getConsumer(string $name): Consumer
return $this->consumers[$name];
}


/**
* @throws ConsumerFactoryException
*/
Expand Down
1 change: 0 additions & 1 deletion src/DI/Helpers/AbstractHelper.php
Expand Up @@ -16,6 +16,5 @@ public function __construct(
) {
}


abstract public function getConfigSchema(): Schema;
}
2 changes: 0 additions & 2 deletions src/DI/Helpers/ExchangesHelper.php
Expand Up @@ -16,7 +16,6 @@ final class ExchangesHelper extends AbstractHelper
{

public const EXCHANGE_TYPES = ['direct', 'topic', 'headers', 'fanout'];
//public const CREATE_TYPES = [0 => false, 1 => true, 2 => 'lazy'];

public function getConfigSchema(): Schema
{
Expand Down Expand Up @@ -59,7 +58,6 @@ public function getConfigSchema(): Schema
);
}


/**
* @throws \InvalidArgumentException
* @param array<string, mixed> $config
Expand Down
1 change: 1 addition & 0 deletions src/DI/Helpers/ProducersHelper.php
Expand Up @@ -33,6 +33,7 @@ public function getConfigSchema(): Schema
'string'
);
}

/**
* @param array<string, mixed> $config
*/
Expand Down
2 changes: 0 additions & 2 deletions src/DI/RabbitMQExtension.php
Expand Up @@ -19,7 +19,6 @@
use Nette\DI\Definitions\Statement;
use Nette\DI\PhpGenerator;
use Nette\PhpGenerator\PhpLiteral;
use Nette\PhpGenerator\Closure;
use Nette\Schema\Expect;
use Nette\Schema\Schema;

Expand Down Expand Up @@ -83,7 +82,6 @@ public function loadConfiguration(): void
$this->setupConsoleCommand();
}


public function setupConsoleCommand(): void
{
$builder = $this->getContainerBuilder();
Expand Down
2 changes: 0 additions & 2 deletions src/Diagnostics/BarPanel.php
Expand Up @@ -41,7 +41,6 @@ function (string $message) use ($name): void {
);
}


public function getTab(): string
{
$img = Html::el('')->addHtml((string) file_get_contents(__DIR__ . '/rabbitmq-icon.svg'));
Expand All @@ -55,7 +54,6 @@ public function getTab(): string
return (string) $tab;
}


public function getPanel(): string
{
ob_start(static function (): void {
Expand Down
2 changes: 0 additions & 2 deletions src/Exchange/Exchange.php
Expand Up @@ -19,7 +19,6 @@ public function __construct(
) {
}


public function getName(): string
{
return $this->name;
Expand All @@ -33,7 +32,6 @@ public function getQueueBindings(): array
return $this->queueBindings;
}


public function getConnection(): IConnection
{
return $this->connection;
Expand Down
8 changes: 5 additions & 3 deletions src/Exchange/ExchangeDeclarator.php
Expand Up @@ -10,11 +10,13 @@

final class ExchangeDeclarator
{
public function __construct(private ConnectionFactory $connectionFactory, private ExchangesDataBag $exchangesDataBag, private QueueFactory $queueFactory)
{
public function __construct(
private ConnectionFactory $connectionFactory,
private ExchangesDataBag $exchangesDataBag,
private QueueFactory $queueFactory
) {
}


public function declareExchange(string $name): void
{
try {
Expand Down
1 change: 0 additions & 1 deletion src/Exchange/IExchange.php
Expand Up @@ -16,6 +16,5 @@ public function getName(): string;
*/
public function getQueueBindings(): array;


public function getConnection(): IConnection;
}
2 changes: 0 additions & 2 deletions src/Exchange/QueueBinding.php
Expand Up @@ -13,13 +13,11 @@ public function __construct(private IQueue $queue, private string $routingKey)
{
}


public function getQueue(): IQueue
{
return $this->queue;
}


public function getRoutingKey(): string
{
return $this->routingKey;
Expand Down
2 changes: 1 addition & 1 deletion src/Producer/Producer.php
Expand Up @@ -58,7 +58,7 @@ public function addOnPublishCallback(callable $callback): void

public function sendHeartbeat(): void
{
trigger_error(__METHOD__ . '() is deprecated, use dependency ConnectionFactory::sendHeartbeat().', E_USER_DEPRECATED);
trigger_error(__METHOD__ . '() is deprecated, use ConnectionFactory::sendHeartbeat().', E_USER_DEPRECATED);
if ($this->queue !== null) {
$this->queue->getConnection()->sendHeartbeat();
}
Expand Down
12 changes: 6 additions & 6 deletions src/Producer/ProducerFactory.php
Expand Up @@ -22,12 +22,14 @@ final class ProducerFactory
*/
private array $producers = [];


public function __construct(private ProducersDataBag $producersDataBag, private QueueFactory $queueFactory, private ExchangeFactory $exchangeFactory, private LazyDeclarator $lazyDeclarator)
{
public function __construct(
private ProducersDataBag $producersDataBag,
private QueueFactory $queueFactory,
private ExchangeFactory $exchangeFactory,
private LazyDeclarator $lazyDeclarator
) {
}


/**
* @throws ProducerFactoryException
*/
Expand All @@ -40,13 +42,11 @@ public function getProducer(string $name): Producer
return $this->producers[$name];
}


public function addOnCreatedCallback(callable $callback): void
{
$this->createdCallbacks[] = $callback;
}


/**
* @throws ProducerFactoryException
*/
Expand Down
1 change: 0 additions & 1 deletion src/Producer/ProducersDataBag.php
Expand Up @@ -22,7 +22,6 @@ public function __construct(array $data)
}
}


/**
* @param string $producerName
* @param array<string, mixed> $data
Expand Down
8 changes: 4 additions & 4 deletions src/Queue/Queue.php
Expand Up @@ -9,17 +9,17 @@
final class Queue implements IQueue
{

public function __construct(private string $name, private IConnection $connection)
{
public function __construct(
private string $name,
private IConnection $connection
) {
}


public function getName(): string
{
return $this->name;
}


public function getConnection(): IConnection
{
return $this->connection;
Expand Down
5 changes: 1 addition & 4 deletions src/Queue/QueueFactory.php
Expand Up @@ -16,15 +16,13 @@ final class QueueFactory
*/
private array $queues = [];


public function __construct(
private QueuesDataBag $queuesDataBag,
private ConnectionFactory $connectionFactory,
private QueueDeclarator $queueDeclarator
) {
}


/**
* @throws QueueFactoryException
*/
Expand All @@ -37,10 +35,9 @@ public function getQueue(string $name): IQueue
return $this->queues[$name];
}


/**
* @throws QueueFactoryException
* @throws ConnectionFactoryException
* @throws ConnectionFactoryException|\Exception
*/
private function create(string $name): IQueue
{
Expand Down

0 comments on commit f52b042

Please sign in to comment.