Skip to content

Commit

Permalink
Merge pull request #516 from php-enqueue/add-declare-strict
Browse files Browse the repository at this point in the history
Add declare strict
  • Loading branch information
makasim authored Aug 26, 2018
2 parents 3cf596f + 735746f commit 19e2dac
Show file tree
Hide file tree
Showing 107 changed files with 223 additions and 135 deletions.
2 changes: 2 additions & 0 deletions bin/subtree-split
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ remote test git@github.com:php-enqueue/test.git
remote async-event-dispatcher git@github.com:php-enqueue/async-event-dispatcher.git
remote async-command git@github.com:php-enqueue/async-command.git
remote mongodb git@github.com:php-enqueue/mongodb.git
remote dsn git@github.com:php-enqueue/dsn.git

split 'pkg/enqueue' enqueue
split 'pkg/simple-client' simple-client
Expand All @@ -88,3 +89,4 @@ split 'pkg/test' test
split 'pkg/async-event-dispatcher' async-event-dispatcher
split 'pkg/async-command' async-command
split 'pkg/mongodb' mongodb
split 'pkg/dsn' dsn
2 changes: 2 additions & 0 deletions pkg/amqp-bunny/AmqpConnectionFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Enqueue\AmqpTools\ConnectionConfig;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-bunny/AmqpConsumer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Bunny\Channel;
Expand Down
9 changes: 3 additions & 6 deletions pkg/amqp-bunny/AmqpContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Bunny\Channel;
Expand Down Expand Up @@ -45,11 +47,6 @@ class AmqpContext implements InteropAmqpContext, DelayStrategyAware
*/
private $config;

/**
* @var AmqpSubscriptionConsumer
*/
private $bcSubscriptionConsumer;

/**
* Callable must return instance of \Bunny\Channel once called.
*
Expand Down Expand Up @@ -330,7 +327,7 @@ public function convertMessage(Message $bunnyMessage): InteropAmqpMessage
}

$message = new AmqpMessage($bunnyMessage->content, $properties, $headers);
$message->setDeliveryTag($bunnyMessage->deliveryTag);
$message->setDeliveryTag((int) $bunnyMessage->deliveryTag);
$message->setRedelivered($bunnyMessage->redelivered);
$message->setRoutingKey($bunnyMessage->routingKey);

Expand Down
4 changes: 3 additions & 1 deletion pkg/amqp-bunny/AmqpProducer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Bunny\Channel;
Expand Down Expand Up @@ -136,7 +138,7 @@ private function doSend(InteropAmqpDestination $destination, InteropAmqpMessage
$amqpProperties = $message->getHeaders();

if (array_key_exists('timestamp', $amqpProperties) && null !== $amqpProperties['timestamp']) {
$amqpProperties['timestamp'] = \DateTime::createFromFormat('U', $amqpProperties['timestamp']);
$amqpProperties['timestamp'] = \DateTime::createFromFormat('U', (string) $amqpProperties['timestamp']);
}

if ($appProperties = $message->getProperties()) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-bunny/AmqpSubscriptionConsumer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Bunny\Channel;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-bunny/BunnyClient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpBunny;

use Bunny\Client;
Expand Down
12 changes: 6 additions & 6 deletions pkg/amqp-bunny/Tests/AmqpConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testOnAcknowledgeShouldAcknowledgeMessage()
->method('ack')
->with($this->isInstanceOf(Message::class))
->willReturnCallback(function (Message $message) {
$this->assertSame('theDeliveryTag', $message->deliveryTag);
$this->assertSame(145, $message->deliveryTag);
});

$context = $this->createContextMock();
Expand All @@ -81,7 +81,7 @@ public function testOnAcknowledgeShouldAcknowledgeMessage()
$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

$message = new AmqpMessage();
$message->setDeliveryTag('theDeliveryTag');
$message->setDeliveryTag(145);

$consumer->acknowledge($message);
}
Expand All @@ -94,7 +94,7 @@ public function testOnRejectShouldRejectMessage()
->method('reject')
->with($this->isInstanceOf(Message::class), false)
->willReturnCallback(function (Message $message) {
$this->assertSame('theDeliveryTag', $message->deliveryTag);
$this->assertSame(167, $message->deliveryTag);
});

$context = $this->createContextMock();
Expand All @@ -107,7 +107,7 @@ public function testOnRejectShouldRejectMessage()
$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

$message = new AmqpMessage();
$message->setDeliveryTag('theDeliveryTag');
$message->setDeliveryTag(167);

$consumer->reject($message, false);
}
Expand All @@ -120,7 +120,7 @@ public function testOnRejectShouldRequeueMessage()
->method('reject')
->with($this->isInstanceOf(Message::class), true)
->willReturnCallback(function (Message $message) {
$this->assertSame('theDeliveryTag', $message->deliveryTag);
$this->assertSame(178, $message->deliveryTag);
});

$context = $this->createContextMock();
Expand All @@ -133,7 +133,7 @@ public function testOnRejectShouldRequeueMessage()
$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

$message = new AmqpMessage();
$message->setDeliveryTag('theDeliveryTag');
$message->setDeliveryTag(178);

$consumer->reject($message, true);
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-lib/AmqpConnectionFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

use Enqueue\AmqpTools\ConnectionConfig;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-lib/AmqpConsumer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

use Interop\Amqp\AmqpConsumer as InteropAmqpConsumer;
Expand Down
4 changes: 3 additions & 1 deletion pkg/amqp-lib/AmqpContext.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

use Enqueue\AmqpTools\DelayStrategyAware;
Expand Down Expand Up @@ -307,7 +309,7 @@ public function convertMessage(LibAMQPMessage $amqpMessage): InteropAmqpMessage
unset($headers['application_headers']);

$message = new AmqpMessage($amqpMessage->getBody(), $properties, $headers);
$message->setDeliveryTag($amqpMessage->delivery_info['delivery_tag']);
$message->setDeliveryTag((int) $amqpMessage->delivery_info['delivery_tag']);
$message->setRedelivered($amqpMessage->delivery_info['redelivered']);
$message->setRoutingKey($amqpMessage->delivery_info['routing_key']);

Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-lib/AmqpProducer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

use Enqueue\AmqpTools\DelayStrategyAware;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-lib/AmqpSubscriptionConsumer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

use Enqueue\AmqpTools\SignalSocketHelper;
Expand Down
43 changes: 0 additions & 43 deletions pkg/amqp-lib/Buffer.php

This file was deleted.

2 changes: 2 additions & 0 deletions pkg/amqp-lib/StopBasicConsumptionException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpLib;

class StopBasicConsumptionException extends \LogicException
Expand Down
8 changes: 4 additions & 4 deletions pkg/amqp-lib/Tests/AmqpConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testOnAcknowledgeShouldAcknowledgeMessage()
$channel
->expects($this->once())
->method('basic_ack')
->with('delivery-tag')
->with(167)
;

$context = $this->createContextMock();
Expand All @@ -80,7 +80,7 @@ public function testOnAcknowledgeShouldAcknowledgeMessage()
$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

$message = new AmqpMessage();
$message->setDeliveryTag('delivery-tag');
$message->setDeliveryTag(167);

$consumer->acknowledge($message);
}
Expand All @@ -91,7 +91,7 @@ public function testOnRejectShouldRejectMessage()
$channel
->expects($this->once())
->method('basic_reject')
->with('delivery-tag', $this->isTrue())
->with(125, $this->isTrue())
;

$context = $this->createContextMock();
Expand All @@ -104,7 +104,7 @@ public function testOnRejectShouldRejectMessage()
$consumer = new AmqpConsumer($context, new AmqpQueue('aName'));

$message = new AmqpMessage();
$message->setDeliveryTag('delivery-tag');
$message->setDeliveryTag(125);

$consumer->reject($message, true);
}
Expand Down
64 changes: 0 additions & 64 deletions pkg/amqp-lib/Tests/BufferTest.php

This file was deleted.

2 changes: 2 additions & 0 deletions pkg/amqp-tools/ConnectionConfig.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

/**
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-tools/DelayStrategy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

use Interop\Amqp\AmqpContext;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-tools/DelayStrategyAware.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

interface DelayStrategyAware
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-tools/DelayStrategyAwareTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

trait DelayStrategyAwareTrait
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-tools/DelayStrategyTransportFactoryTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
2 changes: 2 additions & 0 deletions pkg/amqp-tools/RabbitMqDelayPluginDelayStrategy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Enqueue\AmqpTools;

use Interop\Amqp\AmqpContext;
Expand Down
Loading

0 comments on commit 19e2dac

Please sign in to comment.