Skip to content

Commit

Permalink
Running php-cs-fixer
Browse files Browse the repository at this point in the history
Running php-cs-fixer to fix CS drift
  • Loading branch information
JimTools committed Jan 17, 2025
1 parent 19c7177 commit 0baf319
Show file tree
Hide file tree
Showing 20 changed files with 14 additions and 92 deletions.
10 changes: 5 additions & 5 deletions AmqpConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AmqpConnectionFactory implements InteropAmqpConnectionFactory, DelayStrate
private $client;

/**
* @see \Enqueue\AmqpTools\ConnectionConfig for possible config formats and values
* @see ConnectionConfig for possible config formats and values
*
* @param array|string|null $config
*/
Expand Down Expand Up @@ -89,10 +89,10 @@ private function establishConnection(): BunnyClient
$bunnyConfig['timeout'] = $this->config->getConnectionTimeout();

// @see https://github.com/php-enqueue/enqueue-dev/issues/229
// $bunnyConfig['persistent'] = $this->config->isPersisted();
// if ($this->config->isPersisted()) {
// $bunnyConfig['path'] = 'enqueue';//$this->config->getOption('path', $this->config->getOption('vhost'));
// }
// $bunnyConfig['persistent'] = $this->config->isPersisted();
// if ($this->config->isPersisted()) {
// $bunnyConfig['path'] = 'enqueue';//$this->config->getOption('path', $this->config->getOption('vhost'));
// }

if ($this->config->getHeartbeat()) {
$bunnyConfig['heartbeat'] = $this->config->getHeartbeat();
Expand Down
4 changes: 2 additions & 2 deletions AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(AmqpContext $context, InteropAmqpQueue $queue)
$this->flags = self::FLAG_NOPARAM;
}

public function setConsumerTag(string $consumerTag = null): void
public function setConsumerTag(?string $consumerTag = null): void
{
$this->consumerTag = $consumerTag;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public function receive(int $timeout = 0): ?Message
return $message;
}

usleep(100000); //100ms
usleep(100000); // 100ms
}

return null;
Expand Down
6 changes: 1 addition & 5 deletions AmqpContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AmqpContext implements InteropAmqpContext, DelayStrategyAware
* Callable must return instance of \Bunny\Channel once called.
*
* @param Channel|callable $bunnyChannel
* @param array $config
*/
public function __construct($bunnyChannel, array $config)
{
Expand Down Expand Up @@ -294,10 +293,7 @@ public function getBunnyChannel(): Channel
if (false == $this->bunnyChannel) {
$bunnyChannel = call_user_func($this->bunnyChannelFactory);
if (false == $bunnyChannel instanceof Channel) {
throw new \LogicException(sprintf(
'The factory must return instance of \Bunny\Channel. It returned %s',
is_object($bunnyChannel) ? get_class($bunnyChannel) : gettype($bunnyChannel)
));
throw new \LogicException(sprintf('The factory must return instance of \Bunny\Channel. It returned %s', is_object($bunnyChannel) ? $bunnyChannel::class : gettype($bunnyChannel)));
}

$this->bunnyChannel = $bunnyChannel;
Expand Down
6 changes: 3 additions & 3 deletions AmqpProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function send(Destination $destination, Message $message): void
/**
* @return self
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
if (null === $this->delayStrategy) {
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
Expand All @@ -98,7 +98,7 @@ public function getDeliveryDelay(): ?int
/**
* @return self
*/
public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->priority = $priority;

Expand All @@ -113,7 +113,7 @@ public function getPriority(): ?int
/**
* @return self
*/
public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->timeToLive = $timeToLive;

Expand Down
6 changes: 3 additions & 3 deletions AmqpSubscriptionConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function consume(int $timeout = 0): void
try {
$this->context->getBunnyChannel()->getClient()->run(0 !== $timeout ? $timeout / 1000 : null);
} catch (ClientException $e) {
if (0 === strpos($e->getMessage(), 'stream_select() failed') && $signalHandler->wasThereSignal()) {
if (str_starts_with($e->getMessage(), 'stream_select() failed') && $signalHandler->wasThereSignal()) {
return;
}

Expand All @@ -63,7 +63,7 @@ public function consume(int $timeout = 0): void
public function subscribe(Consumer $consumer, callable $callback): void
{
if (false == $consumer instanceof AmqpConsumer) {
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, $consumer::class));
}

if ($consumer->getConsumerTag() && array_key_exists($consumer->getConsumerTag(), $this->subscribers)) {
Expand Down Expand Up @@ -110,7 +110,7 @@ public function subscribe(Consumer $consumer, callable $callback): void
public function unsubscribe(Consumer $consumer): void
{
if (false == $consumer instanceof AmqpConsumer) {
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, $consumer::class));
}

if (false == $consumer->getConsumerTag()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public function test()
$this->markTestIncomplete();
}

/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -31,8 +28,6 @@ protected function createContext()

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(Context $context, $queueName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class AmqpSendAndReceiveDelayedMessageWithDlxStrategyTest extends SendAndReceiveDelayedMessageFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -26,8 +23,6 @@ protected function createContext()

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(Context $context, $queueName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
class AmqpSendAndReceivePriorityMessagesFromQueueTest extends SendAndReceivePriorityMessagesFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -23,8 +20,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
class AmqpSendAndReceiveTimeToLiveMessagesFromQueueTest extends SendAndReceiveTimeToLiveMessagesFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -23,8 +20,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand Down
3 changes: 0 additions & 3 deletions Tests/Spec/AmqpSendAndReceiveTimestampAsIntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/
class AmqpSendAndReceiveTimestampAsIntegerTest extends SendAndReceiveTimestampAsIntegerSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand Down
5 changes: 0 additions & 5 deletions Tests/Spec/AmqpSendToAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
class AmqpSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -23,8 +20,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand Down
5 changes: 0 additions & 5 deletions Tests/Spec/AmqpSendToAndReceiveFromTopicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class AmqpSendToAndReceiveFromTopicTest extends SendToAndReceiveFromTopicSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -24,8 +21,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createTopic(Context $context, $topicName)
Expand Down
5 changes: 0 additions & 5 deletions Tests/Spec/AmqpSendToAndReceiveNoWaitFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
class AmqpSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -23,8 +20,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand Down
5 changes: 0 additions & 5 deletions Tests/Spec/AmqpSendToAndReceiveNoWaitFromTopicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class AmqpSendToAndReceiveNoWaitFromTopicTest extends SendToAndReceiveNoWaitFromTopicSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -24,8 +21,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createTopic(Context $context, $topicName)
Expand Down
7 changes: 0 additions & 7 deletions Tests/Spec/AmqpSendToTopicAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
class AmqpSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -25,8 +22,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand All @@ -41,8 +36,6 @@ protected function createQueue(Context $context, $queueName)
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createTopic(Context $context, $topicName)
Expand Down
7 changes: 0 additions & 7 deletions Tests/Spec/AmqpSendToTopicAndReceiveNoWaitFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
class AmqpSendToTopicAndReceiveNoWaitFromQueueTest extends SendToTopicAndReceiveNoWaitFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand All @@ -25,8 +22,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand All @@ -41,8 +36,6 @@ protected function createQueue(Context $context, $queueName)
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createTopic(Context $context, $topicName)
Expand Down
5 changes: 0 additions & 5 deletions Tests/Spec/AmqpSslSendToAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function test()
parent::test();
}

/**
* {@inheritdoc}
*/
protected function createContext()
{
$baseDir = realpath(__DIR__.'/../../../../');
Expand All @@ -44,8 +41,6 @@ protected function createContext()
}

/**
* {@inheritdoc}
*
* @param AmqpContext $context
*/
protected function createQueue(Context $context, $queueName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends Subscri
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
Expand All @@ -30,8 +28,6 @@ protected function createContext()

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(Context $context, $queueName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ protected function tearDown(): void

/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
Expand All @@ -39,8 +37,6 @@ protected function createContext()

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(Context $context, $queueName)
{
Expand Down
Loading

0 comments on commit 0baf319

Please sign in to comment.