Skip to content

Commit aaf4cce

Browse files
committed
Running php-cs-fixer
Running php-cs-fixer to fix CS drift
1 parent 282aa5c commit aaf4cce

11 files changed

+20
-20
lines changed

SnsQsConnectionFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ private function parseDsn(string $dsn): void
8383
$dsn = Dsn::parseFirst($dsn);
8484

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

9289
$this->parseOptions($dsn->getQuery());

SnsQsConsumer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getVisibilityTimeout(): ?int
4444
* The duration (in seconds) that the received messages are hidden from subsequent retrieve
4545
* requests after being retrieved by a ReceiveMessage request.
4646
*/
47-
public function setVisibilityTimeout(int $visibilityTimeout = null): void
47+
public function setVisibilityTimeout(?int $visibilityTimeout = null): void
4848
{
4949
$this->consumer->setVisibilityTimeout($visibilityTimeout);
5050
}

SnsQsContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private function getSnsContext(): SnsContext
189189
if (null === $this->snsContext) {
190190
$context = call_user_func($this->snsContextFactory);
191191
if (false == $context instanceof SnsContext) {
192-
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SnsContext::class, is_object($context) ? get_class($context) : gettype($context)));
192+
throw new \LogicException(sprintf('The factory must return instance of %s. It returned %s', SnsContext::class, is_object($context) ? $context::class : gettype($context)));
193193
}
194194

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

209209
$this->sqsContext = $context;

SnsQsMessage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
string $body = '',
4242
array $properties = [],
4343
array $headers = [],
44-
array $messageAttributes = null
44+
?array $messageAttributes = null,
4545
) {
4646
$this->body = $body;
4747
$this->properties = $properties;
@@ -77,7 +77,7 @@ public function setMessageAttributes(?array $messageAttributes): void
7777
* any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute
7878
* deduplication interval. For more information, see http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing.
7979
*/
80-
public function setMessageDeduplicationId(string $id = null): void
80+
public function setMessageDeduplicationId(?string $id = null): void
8181
{
8282
$this->messageDeduplicationId = $id;
8383
}
@@ -96,7 +96,7 @@ public function getMessageDeduplicationId(): ?string
9696
* for multiple users). In this scenario, multiple readers can process the queue, but the session data
9797
* of each user is processed in a FIFO fashion.
9898
*/
99-
public function setMessageGroupId(string $id = null): void
99+
public function setMessageGroupId(?string $id = null): void
100100
{
101101
$this->messageGroupId = $id;
102102
}

SnsQsProducer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function send(Destination $destination, Message $message): void
5151
InvalidMessageException::assertMessageInstanceOf($message, SnsQsMessage::class);
5252

5353
if (false == $destination instanceof SnsQsTopic && false == $destination instanceof SnsQsQueue) {
54-
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)));
54+
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)));
5555
}
5656

5757
if ($destination instanceof SnsQsTopic) {
@@ -82,7 +82,7 @@ public function send(Destination $destination, Message $message): void
8282
/**
8383
* Delivery delay is supported by SQSProducer.
8484
*/
85-
public function setDeliveryDelay(int $deliveryDelay = null): Producer
85+
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
8686
{
8787
$this->getSqsProducer()->setDeliveryDelay($deliveryDelay);
8888

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

100-
public function setPriority(int $priority = null): Producer
100+
public function setPriority(?int $priority = null): Producer
101101
{
102102
$this->getSnsProducer()->setPriority($priority);
103103
$this->getSqsProducer()->setPriority($priority);
@@ -110,7 +110,7 @@ public function getPriority(): ?int
110110
return $this->getSnsProducer()->getPriority();
111111
}
112112

113-
public function setTimeToLive(int $timeToLive = null): Producer
113+
public function setTimeToLive(?int $timeToLive = null): Producer
114114
{
115115
$this->getSnsProducer()->setTimeToLive($timeToLive);
116116
$this->getSqsProducer()->setTimeToLive($timeToLive);

Tests/Spec/SnsQsFactoryTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function createSnsQsContext(): SnsQsContext
3333

3434
protected function createSnsQsQueue(string $queueName): SnsQsQueue
3535
{
36-
$queueName = $queueName.time();
36+
$queueName .= time();
3737

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

4848
protected function createSnsQsTopic(string $topicName): SnsQsTopic
4949
{
50-
$topicName = $topicName.time();
50+
$topicName .= time();
5151

5252
$this->snsQsTopic = $this->snsQsContext->createTopic($topicName);
5353
$this->snsQsContext->declareTopic($this->snsQsTopic);

Tests/Spec/SnsQsSendToAndReceiveFromQueueTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* @group functional
11+
*
1112
* @retry 5
1213
*/
1314
class SnsQsSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec

Tests/Spec/SnsQsSendToAndReceiveNoWaitFromQueueTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* @group functional
11+
*
1112
* @retry 5
1213
*/
1314
class SnsQsSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFromQueueSpec

Tests/Spec/SnsQsSendToTopicAndReceiveFromQueueSpec.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* @group functional
11+
*
1112
* @retry 5
1213
*/
1314
class SnsQsSendToTopicAndReceiveFromQueueSpec extends SendToTopicAndReceiveFromQueueSpec

examples/consumer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ($autoload) {
1313
require_once $autoload;
1414
} else {
15-
throw new \LogicException('Composer autoload was not found');
15+
throw new LogicException('Composer autoload was not found');
1616
}
1717

1818
use Enqueue\SnsQs\SnsQsConnectionFactory;
@@ -34,7 +34,7 @@
3434
while (true) {
3535
if ($m = $consumer->receive(20000)) {
3636
$consumer->acknowledge($m);
37-
echo 'Received message: '.$m->getBody().' '.json_encode($m->getHeaders()).' '.json_encode($m->getProperties()).PHP_EOL;
37+
echo 'Received message: '.$m->getBody().' '.json_encode($m->getHeaders()).' '.json_encode($m->getProperties()).\PHP_EOL;
3838
}
3939
}
4040
echo 'Done'."\n";

examples/produce.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ($autoload) {
1313
require_once $autoload;
1414
} else {
15-
throw new \LogicException('Composer autoload was not found');
15+
throw new LogicException('Composer autoload was not found');
1616
}
1717

1818
use Enqueue\SnsQs\SnsQsConnectionFactory;
@@ -33,7 +33,7 @@
3333

3434
while (true) {
3535
$context->createProducer()->send($topic, $message);
36-
echo 'Sent message: '.$message->getBody().PHP_EOL;
36+
echo 'Sent message: '.$message->getBody().\PHP_EOL;
3737
sleep(1);
3838
}
3939

0 commit comments

Comments
 (0)