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 9a9aa5d commit 2395981
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 47 deletions.
7 changes: 1 addition & 6 deletions SqsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ private function resolveClient(): void
}
}

throw new \LogicException(sprintf(
'The input client must be an instance of "%s" or "%s" or a callable that returns one of those. Got "%s"',
AwsSqsClient::class,
MultiRegionClient::class,
is_object($client) ? get_class($client) : gettype($client)
));
throw new \LogicException(sprintf('The input client must be an instance of "%s" or "%s" or a callable that returns one of those. Got "%s"', AwsSqsClient::class, MultiRegionClient::class, is_object($client) ? $client::class : gettype($client)));
}
}
2 changes: 1 addition & 1 deletion SqsConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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->visibilityTimeout = $visibilityTimeout;
}
Expand Down
2 changes: 1 addition & 1 deletion SqsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function getSqsClient(): SqsClient
*/
public function getClient(): AwsSqsClient
{
@trigger_error('The method is deprecated since 0.9.2. SqsContext::getAwsSqsClient() method should be used.', E_USER_DEPRECATED);
@trigger_error('The method is deprecated since 0.9.2. SqsContext::getAwsSqsClient() method should be used.', \E_USER_DEPRECATED);

return $this->getAwsSqsClient();
}
Expand Down
14 changes: 7 additions & 7 deletions SqsDestination.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getAttributes(): array
* The number of seconds for which the delivery of all messages in the queue is delayed.
* Valid values: An integer from 0 to 900 seconds (15 minutes). The default is 0 (zero).
*/
public function setDelaySeconds(int $seconds = null): void
public function setDelaySeconds(?int $seconds = null): void
{
if (null == $seconds) {
unset($this->attributes['DelaySeconds']);
Expand All @@ -76,7 +76,7 @@ public function setDelaySeconds(int $seconds = null): void
* Valid values: An integer from 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB).
* The default is 262,144 (256 KiB).
*/
public function setMaximumMessageSize(int $bytes = null): void
public function setMaximumMessageSize(?int $bytes = null): void
{
if (null == $bytes) {
unset($this->attributes['MaximumMessageSize']);
Expand All @@ -90,7 +90,7 @@ public function setMaximumMessageSize(int $bytes = null): void
* Valid values: An integer from 60 seconds (1 minute) to 1,209,600 seconds (14 days).
* The default is 345,600 (4 days).
*/
public function setMessageRetentionPeriod(int $seconds = null): void
public function setMessageRetentionPeriod(?int $seconds = null): void
{
if (null == $seconds) {
unset($this->attributes['MessageRetentionPeriod']);
Expand All @@ -103,7 +103,7 @@ public function setMessageRetentionPeriod(int $seconds = null): void
* The queue's policy. A valid AWS policy. For more information about policy structure,
* see http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html.
*/
public function setPolicy(string $policy = null): void
public function setPolicy(?string $policy = null): void
{
if (null == $policy) {
unset($this->attributes['Policy']);
Expand All @@ -116,7 +116,7 @@ public function setPolicy(string $policy = null): void
* The number of seconds for which a ReceiveMessage action waits for a message to arrive.
* Valid values: An integer from 0 to 20 (seconds). The default is 0 (zero).
*/
public function setReceiveMessageWaitTimeSeconds(int $seconds = null): void
public function setReceiveMessageWaitTimeSeconds(?int $seconds = null): void
{
if (null == $seconds) {
unset($this->attributes['ReceiveMessageWaitTimeSeconds']);
Expand Down Expand Up @@ -145,7 +145,7 @@ public function setRedrivePolicy(int $maxReceiveCount, string $deadLetterTargetA
* The default is 30. For more information about the visibility timeout,
* see http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html.
*/
public function setVisibilityTimeout(int $seconds = null): void
public function setVisibilityTimeout(?int $seconds = null): void
{
if (null == $seconds) {
unset($this->attributes['VisibilityTimeout']);
Expand Down Expand Up @@ -208,7 +208,7 @@ public function setQueueOwnerAWSAccountId(?string $queueOwnerAWSAccountId): void
$this->queueOwnerAWSAccountId = $queueOwnerAWSAccountId;
}

public function setRegion(string $region = null): void
public function setRegion(?string $region = null): void
{
$this->region = $region;
}
Expand Down
14 changes: 7 additions & 7 deletions SqsMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function setRedelivered(bool $redelivered): void
$this->redelivered = $redelivered;
}

public function setReplyTo(string $replyTo = null): void
public function setReplyTo(?string $replyTo = null): void
{
$this->setHeader('reply_to', $replyTo);
}
Expand All @@ -154,7 +154,7 @@ public function getReplyTo(): ?string
return $this->getHeader('reply_to');
}

public function setCorrelationId(string $correlationId = null): void
public function setCorrelationId(?string $correlationId = null): void
{
$this->setHeader('correlation_id', $correlationId);
}
Expand All @@ -164,7 +164,7 @@ public function getCorrelationId(): ?string
return $this->getHeader('correlation_id');
}

public function setMessageId(string $messageId = null): void
public function setMessageId(?string $messageId = null): void
{
$this->setHeader('message_id', $messageId);
}
Expand All @@ -181,7 +181,7 @@ public function getTimestamp(): ?int
return null === $value ? null : (int) $value;
}

public function setTimestamp(int $timestamp = null): void
public function setTimestamp(?int $timestamp = null): void
{
$this->setHeader('timestamp', $timestamp);
}
Expand Down Expand Up @@ -211,7 +211,7 @@ public function getDelaySeconds(): int
* 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 @@ -230,7 +230,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 All @@ -247,7 +247,7 @@ public function getMessageGroupId(): ?string
* If you receive a message more than once, each time you receive it, you get a different receipt handle.
* You must provide the most recently received receipt handle when you request to delete the message (otherwise, the message might not be deleted).
*/
public function setReceiptHandle(string $receipt = null): void
public function setReceiptHandle(?string $receipt = null): void
{
$this->receiptHandle = $receipt;
}
Expand Down
6 changes: 3 additions & 3 deletions SqsProducer.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 SqsProducer
*/
public function setDeliveryDelay(int $deliveryDelay = null): Producer
public function setDeliveryDelay(?int $deliveryDelay = null): Producer
{
$this->deliveryDelay = $deliveryDelay;

Expand All @@ -96,7 +96,7 @@ public function getDeliveryDelay(): ?int
/**
* @return SqsProducer
*/
public function setPriority(int $priority = null): Producer
public function setPriority(?int $priority = null): Producer
{
if (null === $priority) {
return $this;
Expand All @@ -113,7 +113,7 @@ public function getPriority(): ?int
/**
* @return SqsProducer
*/
public function setTimeToLive(int $timeToLive = null): Producer
public function setTimeToLive(?int $timeToLive = null): Producer
{
if (null === $timeToLive) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Spec/CreateSqsQueueTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait CreateSqsQueueTrait

protected function createSqsQueue(SqsContext $context, string $queueName): SqsDestination
{
$queueName = $queueName.time();
$queueName .= time();

$this->queue = $context->createQueue($queueName);
$context->declareQueue($this->queue);
Expand Down
3 changes: 0 additions & 3 deletions Tests/Spec/SqsMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

class SqsMessageTest extends MessageSpec
{
/**
* {@inheritdoc}
*/
protected function createMessage()
{
return new SqsMessage();
Expand Down
3 changes: 0 additions & 3 deletions Tests/Spec/SqsProducerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ class SqsProducerTest extends ProducerSpec
{
use SqsExtension;

/**
* {@inheritdoc}
*/
protected function createProducer()
{
return $this->buildSqsContext()->createProducer();
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendAndReceiveDelayedMessageFromQueueTest extends SendAndReceiveDelayedMessageFromQueueSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendToAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToAndReceiveFromQueueTest extends SendToAndReceiveFromQueueSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
5 changes: 3 additions & 2 deletions Tests/Spec/SqsSendToAndReceiveFromTopicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToAndReceiveFromTopicTest extends SendToAndReceiveFromTopicSpec
{
use SqsExtension;
use RetryTrait;
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;

/**
* @var SqsContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendToAndReceiveNoWaitFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToAndReceiveNoWaitFromQueueTest extends SendToAndReceiveNoWaitFromQueueSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendToAndReceiveNoWaitFromTopicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToAndReceiveNoWaitFromTopicTest extends SendToAndReceiveNoWaitFromTopicSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendToTopicAndReceiveFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveFromQueueSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
3 changes: 2 additions & 1 deletion Tests/Spec/SqsSendToTopicAndReceiveNoWaitFromQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

/**
* @group functional
*
* @retry 5
*/
class SqsSendToTopicAndReceiveNoWaitFromQueueTest extends SendToTopicAndReceiveNoWaitFromQueueSpec
{
use CreateSqsQueueTrait;
use RetryTrait;
use SqsExtension;
use CreateSqsQueueTrait;

/**
* @var SqsContext
Expand Down
3 changes: 0 additions & 3 deletions Tests/SqsConnectionFactoryConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function testThrowIfDsnCouldNotBeParsed()

/**
* @dataProvider provideConfigs
*
* @param mixed $config
* @param mixed $expectedConfig
*/
public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
{
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\Sqs\SqsConnectionFactory;
Expand All @@ -26,7 +26,7 @@
while (true) {
if ($m = $consumer->receive(20000)) {
$consumer->acknowledge($m);
echo 'Received message: '.$m->getBody().PHP_EOL;
echo 'Received message: '.$m->getBody().\PHP_EOL;
}
}

Expand Down
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\Sqs\SqsConnectionFactory;
Expand All @@ -27,7 +27,7 @@

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

Expand Down

0 comments on commit 2395981

Please sign in to comment.