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 282aa5c commit aaf4cce
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
5 changes: 1 addition & 4 deletions SnsQsConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ private function parseDsn(string $dsn): void
$dsn = Dsn::parseFirst($dsn);

if ('snsqs' !== $dsn->getSchemeProtocol()) {
throw new \LogicException(sprintf(
'The given scheme protocol "%s" is not supported. It must be "snsqs"',
$dsn->getSchemeProtocol()
));
throw new \LogicException(sprintf('The given scheme protocol "%s" is not supported. It must be "snsqs"', $dsn->getSchemeProtocol()));
}

$this->parseOptions($dsn->getQuery());
Expand Down
2 changes: 1 addition & 1 deletion SnsQsConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getVisibilityTimeout(): ?int
* The duration (in seconds) that the received messages are hidden from subsequent retrieve
* requests after being retrieved by a ReceiveMessage request.
*/
public function setVisibilityTimeout(int $visibilityTimeout = null): void
public function setVisibilityTimeout(?int $visibilityTimeout = null): void
{
$this->consumer->setVisibilityTimeout($visibilityTimeout);
}
Expand Down
4 changes: 2 additions & 2 deletions SnsQsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private function getSnsContext(): SnsContext
if (null === $this->snsContext) {
$context = call_user_func($this->snsContextFactory);
if (false == $context instanceof SnsContext) {
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SnsContext::class, is_object($context) ? get_class($context) : gettype($context)));
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SnsContext::class, is_object($context) ? $context::class : gettype($context)));
}

$this->snsContext = $context;
Expand All @@ -203,7 +203,7 @@ private function getSqsContext(): SqsContext
if (null === $this->sqsContext) {
$context = call_user_func($this->sqsContextFactory);
if (false == $context instanceof SqsContext) {
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SqsContext::class, is_object($context) ? get_class($context) : gettype($context)));
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SqsContext::class, is_object($context) ? $context::class : gettype($context)));
}

$this->sqsContext = $context;
Expand Down
6 changes: 3 additions & 3 deletions SnsQsMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
string $body = '',
array $properties = [],
array $headers = [],
array $messageAttributes = null
?array $messageAttributes = null,
) {
$this->body = $body;
$this->properties = $properties;
Expand Down Expand Up @@ -77,7 +77,7 @@ public function setMessageAttributes(?array $messageAttributes): void
* any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute
* deduplication interval. For more information, see http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing.
*/
public function setMessageDeduplicationId(string $id = null): void
public function setMessageDeduplicationId(?string $id = null): void
{
$this->messageDeduplicationId = $id;
}
Expand All @@ -96,7 +96,7 @@ public function getMessageDeduplicationId(): ?string
* for multiple users). In this scenario, multiple readers can process the queue, but the session data
* of each user is processed in a FIFO fashion.
*/
public function setMessageGroupId(string $id = null): void
public function setMessageGroupId(?string $id = null): void
{
$this->messageGroupId = $id;
}
Expand Down
8 changes: 4 additions & 4 deletions SnsQsProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function send(Destination $destination, Message $message): void
InvalidMessageException::assertMessageInstanceOf($message, SnsQsMessage::class);

if (false == $destination instanceof SnsQsTopic && false == $destination instanceof SnsQsQueue) {
throw new InvalidDestinationException(sprintf('The destination must be an instance of [%s|%s] but got %s.', SnsQsTopic::class, SnsQsQueue::class, is_object($destination) ? get_class($destination) : gettype($destination)));
throw new InvalidDestinationException(sprintf('The destination must be an instance of [%s|%s] but got %s.', SnsQsTopic::class, SnsQsQueue::class, is_object($destination) ? $destination::class : gettype($destination)));
}

if ($destination instanceof SnsQsTopic) {
Expand Down Expand Up @@ -82,7 +82,7 @@ public function send(Destination $destination, Message $message): void
/**
* Delivery delay is supported by SQSProducer.
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
$this->getSqsProducer()->setDeliveryDelay($deliveryDelay);

Expand All @@ -97,7 +97,7 @@ public function getDeliveryDelay(): ?int
return $this->getSqsProducer()->getDeliveryDelay();
}

public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
$this->getSnsProducer()->setPriority($priority);
$this->getSqsProducer()->setPriority($priority);
Expand All @@ -110,7 +110,7 @@ public function getPriority(): ?int
return $this->getSnsProducer()->getPriority();
}

public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
$this->getSnsProducer()->setTimeToLive($timeToLive);
$this->getSqsProducer()->setTimeToLive($timeToLive);
Expand Down
4 changes: 2 additions & 2 deletions Tests/Spec/SnsQsFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function createSnsQsContext(): SnsQsContext

protected function createSnsQsQueue(string $queueName): SnsQsQueue
{
$queueName = $queueName.time();
$queueName .= time();

$this->snsQsQueue = $this->snsQsContext->createQueue($queueName);
$this->snsQsContext->declareQueue($this->snsQsQueue);
Expand All @@ -47,7 +47,7 @@ protected function createSnsQsQueue(string $queueName): SnsQsQueue

protected function createSnsQsTopic(string $topicName): SnsQsTopic
{
$topicName = $topicName.time();
$topicName .= time();

$this->snsQsTopic = $this->snsQsContext->createTopic($topicName);
$this->snsQsContext->declareTopic($this->snsQsTopic);
Expand Down
1 change: 1 addition & 0 deletions Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* @group functional
*
* @retry 5
*/
class SnsQsSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec
Expand Down
1 change: 1 addition & 0 deletions Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* @group functional
*
* @retry 5
*/
class SnsQsSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFromQueueSpec
Expand Down
1 change: 1 addition & 0 deletions Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* @group functional
*
* @retry 5
*/
class SnsQsSendToTopicAndReceiveFromQueueSpec extends SendToTopicAndReceiveFromQueueSpec
Expand Down
4 changes: 2 additions & 2 deletions examples/consumer.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\SnsQs\SnsQsConnectionFactory;
Expand All @@ -34,7 +34,7 @@
while (true) {
if ($m = $consumer->receive(20000)) {
$consumer->acknowledge($m);
echo 'Received message: '.$m->getBody().' '.json_encode($m->getHeaders()).' '.json_encode($m->getProperties()).PHP_EOL;
echo 'Received message: '.$m->getBody().' '.json_encode($m->getHeaders()).' '.json_encode($m->getProperties()).\PHP_EOL;
}
}
echo 'Done'."\n";
4 changes: 2 additions & 2 deletions examples/produce.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\SnsQs\SnsQsConnectionFactory;
Expand All @@ -33,7 +33,7 @@

while (true) {
$context->createProducer()->send($topic, $message);
echo 'Sent message: '.$message->getBody().PHP_EOL;
echo 'Sent message: '.$message->getBody().\PHP_EOL;
sleep(1);
}

Expand Down

0 comments on commit aaf4cce

Please sign in to comment.