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 af39d30 commit 1660cc1
Show file tree
Hide file tree
Showing 24 changed files with 17 additions and 95 deletions.
2 changes: 1 addition & 1 deletion AmqpConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AmqpConnectionFactory implements InteropAmqpConnectionFactory, DelayStrate
private $connection;

/**
* @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
5 changes: 2 additions & 3 deletions AmqpConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,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 @@ -97,7 +97,7 @@ public function receive(int $timeout = 0): ?Message
return $message;
}

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

return null;
Expand Down Expand Up @@ -127,7 +127,6 @@ public function acknowledge(Message $message): void

/**
* @param InteropAmqpMessage $message
* @param bool $requeue
*/
public function reject(Message $message, bool $requeue = false): void
{
Expand Down
6 changes: 3 additions & 3 deletions AmqpProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,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 @@ -100,7 +100,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 @@ -115,7 +115,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
4 changes: 2 additions & 2 deletions AmqpSubscriptionConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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 @@ -140,7 +140,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
3 changes: 0 additions & 3 deletions Tests/Spec/AmqpProducerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/
class AmqpProducerTest extends ProducerSpec
{
/**
* {@inheritdoc}
*/
protected function createProducer()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class AmqpSendAndReceiveDelayedMessageWithDelayPluginStrategyTest 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 @@ -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/AmqpSendAndReceiveTimestampAsIntengerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/
class AmqpSendAndReceiveTimestampAsIntengerTest 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 @@ -12,9 +12,6 @@
*/
class AmqpSslSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec
{
/**
* {@inheritdoc}
*/
protected function createContext()
{
$baseDir = realpath(__DIR__.'/../../../../');
Expand All @@ -37,8 +34,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
4 changes: 0 additions & 4 deletions Tests/Spec/AmqpSubscriptionConsumerStopOnFalseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class AmqpSubscriptionConsumerStopOnFalseTest extends SubscriptionConsumerStopOn
{
/**
* @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
4 changes: 2 additions & 2 deletions examples/consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if ($autoload) {
require_once $autoload;
} else {
throw new \LogicException('Composer autoload was not found');
throw new LogicException('Composer autoload was not found');
}

use Enqueue\AmqpLib\AmqpConnectionFactory;
Expand All @@ -32,7 +32,7 @@

while (true) {
if ($m = $consumer->receive(100)) {
echo $m->getBody(), PHP_EOL;
echo $m->getBody(), \PHP_EOL;
$consumer->acknowledge($m);
}

Expand Down
Loading

0 comments on commit 1660cc1

Please sign in to comment.