Skip to content

Commit 6bb0014

Browse files
committed
Merge remote-tracking branch 'origin/master' into remove-transport-factories
2 parents 8fb34e9 + 2ead9b5 commit 6bb0014

File tree

391 files changed

+2262
-2289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

391 files changed

+2262
-2289
lines changed

pkg/amqp-bunny/AmqpConnectionFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Enqueue\AmqpTools\DelayStrategyAwareTrait;
1010
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
1111
use Interop\Amqp\AmqpConnectionFactory as InteropAmqpConnectionFactory;
12-
use Interop\Queue\PsrContext;
12+
use Interop\Queue\Context;
1313

1414
class AmqpConnectionFactory implements InteropAmqpConnectionFactory, DelayStrategyAware
1515
{
@@ -46,7 +46,7 @@ public function __construct($config = 'amqp:')
4646
/**
4747
* @return AmqpContext
4848
*/
49-
public function createContext(): PsrContext
49+
public function createContext(): Context
5050
{
5151
if ($this->config->isLazy()) {
5252
$context = new AmqpContext(function () {

pkg/amqp-bunny/AmqpConsumer.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace Enqueue\AmqpBunny;
66

77
use Bunny\Channel;
8-
use Bunny\Message;
8+
use Bunny\Message as BunnyMessage;
99
use Interop\Amqp\AmqpConsumer as InteropAmqpConsumer;
1010
use Interop\Amqp\AmqpMessage as InteropAmqpMessage;
1111
use Interop\Amqp\AmqpQueue as InteropAmqpQueue;
12-
use Interop\Queue\InvalidMessageException;
13-
use Interop\Queue\PsrMessage;
14-
use Interop\Queue\PsrQueue;
12+
use Interop\Queue\Exception\InvalidMessageException;
13+
use Interop\Queue\Message;
14+
use Interop\Queue\Queue;
1515

1616
class AmqpConsumer implements InteropAmqpConsumer
1717
{
@@ -81,15 +81,15 @@ public function setFlags(int $flags): void
8181
/**
8282
* @return InteropAmqpQueue
8383
*/
84-
public function getQueue(): PsrQueue
84+
public function getQueue(): Queue
8585
{
8686
return $this->queue;
8787
}
8888

8989
/**
9090
* @return InteropAmqpMessage
9191
*/
92-
public function receive(int $timeout = 0): ?PsrMessage
92+
public function receive(int $timeout = 0): ?Message
9393
{
9494
$end = microtime(true) + ($timeout / 1000);
9595

@@ -107,7 +107,7 @@ public function receive(int $timeout = 0): ?PsrMessage
107107
/**
108108
* @return InteropAmqpMessage
109109
*/
110-
public function receiveNoWait(): ?PsrMessage
110+
public function receiveNoWait(): ?Message
111111
{
112112
if ($message = $this->channel->get($this->queue->getQueueName(), (bool) ($this->getFlags() & InteropAmqpConsumer::FLAG_NOACK))) {
113113
return $this->context->convertMessage($message);
@@ -119,22 +119,22 @@ public function receiveNoWait(): ?PsrMessage
119119
/**
120120
* @param InteropAmqpMessage $message
121121
*/
122-
public function acknowledge(PsrMessage $message): void
122+
public function acknowledge(Message $message): void
123123
{
124124
InvalidMessageException::assertMessageInstanceOf($message, InteropAmqpMessage::class);
125125

126-
$bunnyMessage = new Message('', $message->getDeliveryTag(), '', '', '', [], '');
126+
$bunnyMessage = new BunnyMessage('', $message->getDeliveryTag(), '', '', '', [], '');
127127
$this->channel->ack($bunnyMessage);
128128
}
129129

130130
/**
131131
* @param InteropAmqpMessage $message
132132
*/
133-
public function reject(PsrMessage $message, bool $requeue = false): void
133+
public function reject(Message $message, bool $requeue = false): void
134134
{
135135
InvalidMessageException::assertMessageInstanceOf($message, InteropAmqpMessage::class);
136136

137-
$bunnyMessage = new Message('', $message->getDeliveryTag(), '', '', '', [], '');
137+
$bunnyMessage = new BunnyMessage('', $message->getDeliveryTag(), '', '', '', [], '');
138138
$this->channel->reject($bunnyMessage, $requeue);
139139
}
140140
}

pkg/amqp-bunny/AmqpContext.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Enqueue\AmqpBunny;
66

77
use Bunny\Channel;
8-
use Bunny\Message;
8+
use Bunny\Message as BunnyMessage;
99
use Enqueue\AmqpTools\DelayStrategyAware;
1010
use Enqueue\AmqpTools\DelayStrategyAwareTrait;
1111
use Interop\Amqp\AmqpBind as InteropAmqpBind;
@@ -18,15 +18,15 @@
1818
use Interop\Amqp\Impl\AmqpMessage;
1919
use Interop\Amqp\Impl\AmqpQueue;
2020
use Interop\Amqp\Impl\AmqpTopic;
21-
use Interop\Queue\Exception;
22-
use Interop\Queue\InvalidDestinationException;
23-
use Interop\Queue\PsrConsumer;
24-
use Interop\Queue\PsrDestination;
25-
use Interop\Queue\PsrMessage;
26-
use Interop\Queue\PsrProducer;
27-
use Interop\Queue\PsrQueue;
28-
use Interop\Queue\PsrSubscriptionConsumer;
29-
use Interop\Queue\PsrTopic;
21+
use Interop\Queue\Consumer;
22+
use Interop\Queue\Destination;
23+
use Interop\Queue\Exception\Exception;
24+
use Interop\Queue\Exception\InvalidDestinationException;
25+
use Interop\Queue\Message;
26+
use Interop\Queue\Producer;
27+
use Interop\Queue\Queue;
28+
use Interop\Queue\SubscriptionConsumer;
29+
use Interop\Queue\Topic;
3030

3131
class AmqpContext implements InteropAmqpContext, DelayStrategyAware
3232
{
@@ -73,23 +73,23 @@ public function __construct($bunnyChannel, array $config)
7373
/**
7474
* @return InteropAmqpMessage
7575
*/
76-
public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage
76+
public function createMessage(string $body = '', array $properties = [], array $headers = []): Message
7777
{
7878
return new AmqpMessage($body, $properties, $headers);
7979
}
8080

8181
/**
8282
* @return InteropAmqpQueue
8383
*/
84-
public function createQueue(string $name): PsrQueue
84+
public function createQueue(string $name): Queue
8585
{
8686
return new AmqpQueue($name);
8787
}
8888

8989
/**
9090
* @return InteropAmqpTopic
9191
*/
92-
public function createTopic(string $name): PsrTopic
92+
public function createTopic(string $name): Topic
9393
{
9494
return new AmqpTopic($name);
9595
}
@@ -99,9 +99,9 @@ public function createTopic(string $name): PsrTopic
9999
*
100100
* @return AmqpConsumer
101101
*/
102-
public function createConsumer(PsrDestination $destination): PsrConsumer
102+
public function createConsumer(Destination $destination): Consumer
103103
{
104-
$destination instanceof PsrTopic
104+
$destination instanceof Topic
105105
? InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpTopic::class)
106106
: InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpQueue::class)
107107
;
@@ -119,15 +119,15 @@ public function createConsumer(PsrDestination $destination): PsrConsumer
119119
/**
120120
* @return AmqpSubscriptionConsumer
121121
*/
122-
public function createSubscriptionConsumer(): PsrSubscriptionConsumer
122+
public function createSubscriptionConsumer(): SubscriptionConsumer
123123
{
124124
return new AmqpSubscriptionConsumer($this);
125125
}
126126

127127
/**
128128
* @return AmqpProducer
129129
*/
130-
public function createProducer(): PsrProducer
130+
public function createProducer(): Producer
131131
{
132132
$producer = new AmqpProducer($this->getBunnyChannel(), $this);
133133
$producer->setDelayStrategy($this->delayStrategy);
@@ -138,7 +138,7 @@ public function createProducer(): PsrProducer
138138
/**
139139
* @return InteropAmqpQueue
140140
*/
141-
public function createTemporaryQueue(): PsrQueue
141+
public function createTemporaryQueue(): Queue
142142
{
143143
$frame = $this->getBunnyChannel()->queueDeclare('', false, false, true, false);
144144

@@ -199,7 +199,7 @@ public function deleteQueue(InteropAmqpQueue $queue): void
199199
/**
200200
* @param InteropAmqpQueue $queue
201201
*/
202-
public function purgeQueue(PsrQueue $queue): void
202+
public function purgeQueue(Queue $queue): void
203203
{
204204
$this->getBunnyChannel()->queuePurge(
205205
$queue->getQueueName(),
@@ -309,7 +309,7 @@ public function getBunnyChannel(): Channel
309309
/**
310310
* @internal It must be used here and in the consumer only
311311
*/
312-
public function convertMessage(Message $bunnyMessage): InteropAmqpMessage
312+
public function convertMessage(BunnyMessage $bunnyMessage): InteropAmqpMessage
313313
{
314314
$headers = $bunnyMessage->headers;
315315

pkg/amqp-bunny/AmqpProducer.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use Interop\Amqp\AmqpProducer as InteropAmqpProducer;
1313
use Interop\Amqp\AmqpQueue as InteropAmqpQueue;
1414
use Interop\Amqp\AmqpTopic as InteropAmqpTopic;
15-
use Interop\Queue\DeliveryDelayNotSupportedException;
16-
use Interop\Queue\Exception;
17-
use Interop\Queue\InvalidDestinationException;
18-
use Interop\Queue\InvalidMessageException;
19-
use Interop\Queue\PsrDestination;
20-
use Interop\Queue\PsrMessage;
21-
use Interop\Queue\PsrProducer;
22-
use Interop\Queue\PsrTopic;
15+
use Interop\Queue\Destination;
16+
use Interop\Queue\Exception\DeliveryDelayNotSupportedException;
17+
use Interop\Queue\Exception\Exception;
18+
use Interop\Queue\Exception\InvalidDestinationException;
19+
use Interop\Queue\Exception\InvalidMessageException;
20+
use Interop\Queue\Message;
21+
use Interop\Queue\Producer;
22+
use Interop\Queue\Topic;
2323

2424
class AmqpProducer implements InteropAmqpProducer, DelayStrategyAware
2525
{
@@ -60,9 +60,9 @@ public function __construct(Channel $channel, AmqpContext $context)
6060
* @param InteropAmqpTopic|InteropAmqpQueue $destination
6161
* @param InteropAmqpMessage $message
6262
*/
63-
public function send(PsrDestination $destination, PsrMessage $message): void
63+
public function send(Destination $destination, Message $message): void
6464
{
65-
$destination instanceof PsrTopic
65+
$destination instanceof Topic
6666
? InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpTopic::class)
6767
: InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpQueue::class)
6868
;
@@ -79,7 +79,7 @@ public function send(PsrDestination $destination, PsrMessage $message): void
7979
/**
8080
* @return self
8181
*/
82-
public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer
82+
public function setDeliveryDelay(int $deliveryDelay = null): Producer
8383
{
8484
if (null === $this->delayStrategy) {
8585
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
@@ -98,7 +98,7 @@ public function getDeliveryDelay(): ?int
9898
/**
9999
* @return self
100100
*/
101-
public function setPriority(int $priority = null): PsrProducer
101+
public function setPriority(int $priority = null): Producer
102102
{
103103
$this->priority = $priority;
104104

@@ -113,7 +113,7 @@ public function getPriority(): ?int
113113
/**
114114
* @return self
115115
*/
116-
public function setTimeToLive(int $timeToLive = null): PsrProducer
116+
public function setTimeToLive(int $timeToLive = null): Producer
117117
{
118118
$this->timeToLive = $timeToLive;
119119

pkg/amqp-bunny/AmqpSubscriptionConsumer.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Enqueue\AmqpTools\SignalSocketHelper;
1212
use Interop\Amqp\AmqpConsumer as InteropAmqpConsumer;
1313
use Interop\Amqp\AmqpSubscriptionConsumer as InteropAmqpSubscriptionConsumer;
14-
use Interop\Queue\Exception;
15-
use Interop\Queue\PsrConsumer;
14+
use Interop\Queue\Consumer;
15+
use Interop\Queue\Exception\Exception;
1616

1717
class AmqpSubscriptionConsumer implements InteropAmqpSubscriptionConsumer
1818
{
@@ -60,7 +60,7 @@ public function consume(int $timeout = 0): void
6060
/**
6161
* @param AmqpConsumer $consumer
6262
*/
63-
public function subscribe(PsrConsumer $consumer, callable $callback): void
63+
public function subscribe(Consumer $consumer, callable $callback): void
6464
{
6565
if (false == $consumer instanceof AmqpConsumer) {
6666
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));
@@ -107,7 +107,7 @@ public function subscribe(PsrConsumer $consumer, callable $callback): void
107107
/**
108108
* @param AmqpConsumer $consumer
109109
*/
110-
public function unsubscribe(PsrConsumer $consumer): void
110+
public function unsubscribe(Consumer $consumer): void
111111
{
112112
if (false == $consumer instanceof AmqpConsumer) {
113113
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));

pkg/amqp-bunny/Tests/AmqpConnectionFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Enqueue\AmqpBunny\AmqpConnectionFactory;
66
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
77
use Enqueue\Test\ClassExtensionTrait;
8-
use Interop\Queue\PsrConnectionFactory;
8+
use Interop\Queue\ConnectionFactory;
99
use PHPUnit\Framework\TestCase;
1010

1111
class AmqpConnectionFactoryTest extends TestCase
@@ -14,7 +14,7 @@ class AmqpConnectionFactoryTest extends TestCase
1414

1515
public function testShouldImplementConnectionFactoryInterface()
1616
{
17-
$this->assertClassImplements(PsrConnectionFactory::class, AmqpConnectionFactory::class);
17+
$this->assertClassImplements(ConnectionFactory::class, AmqpConnectionFactory::class);
1818
}
1919

2020
public function testShouldSetRabbitMqDlxDelayStrategyIfRabbitMqSchemeExtensionPresent()

pkg/amqp-bunny/Tests/AmqpConsumerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use Enqueue\Test\WriteAttributeTrait;
1313
use Interop\Amqp\Impl\AmqpMessage;
1414
use Interop\Amqp\Impl\AmqpQueue;
15-
use Interop\Queue\InvalidMessageException;
16-
use Interop\Queue\PsrConsumer;
15+
use Interop\Queue\Consumer;
16+
use Interop\Queue\Exception\InvalidMessageException;
1717
use PHPUnit\Framework\TestCase;
1818

1919
class AmqpConsumerTest extends TestCase
@@ -23,7 +23,7 @@ class AmqpConsumerTest extends TestCase
2323

2424
public function testShouldImplementConsumerInterface()
2525
{
26-
$this->assertClassImplements(PsrConsumer::class, AmqpConsumer::class);
26+
$this->assertClassImplements(Consumer::class, AmqpConsumer::class);
2727
}
2828

2929
public function testCouldBeConstructedWithContextAndQueueAsArguments()

pkg/amqp-bunny/Tests/AmqpProducerTest.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use Interop\Amqp\Impl\AmqpMessage;
1212
use Interop\Amqp\Impl\AmqpQueue;
1313
use Interop\Amqp\Impl\AmqpTopic;
14-
use Interop\Queue\DeliveryDelayNotSupportedException;
15-
use Interop\Queue\InvalidDestinationException;
16-
use Interop\Queue\InvalidMessageException;
17-
use Interop\Queue\PsrDestination;
18-
use Interop\Queue\PsrMessage;
19-
use Interop\Queue\PsrProducer;
14+
use Interop\Queue\Destination;
15+
use Interop\Queue\Exception\DeliveryDelayNotSupportedException;
16+
use Interop\Queue\Exception\InvalidDestinationException;
17+
use Interop\Queue\Exception\InvalidMessageException;
18+
use Interop\Queue\Message;
19+
use Interop\Queue\Producer;
2020
use PHPUnit\Framework\TestCase;
2121

2222
class AmqpProducerTest extends TestCase
@@ -28,9 +28,9 @@ public function testCouldBeConstructedWithRequiredArguments()
2828
new AmqpProducer($this->createBunnyChannelMock(), $this->createContextMock());
2929
}
3030

31-
public function testShouldImplementPsrProducerInterface()
31+
public function testShouldImplementQueueInteropProducerInterface()
3232
{
33-
$this->assertClassImplements(PsrProducer::class, AmqpProducer::class);
33+
$this->assertClassImplements(Producer::class, AmqpProducer::class);
3434
}
3535

3636
public function testShouldThrowExceptionWhenDestinationTypeIsInvalid()
@@ -172,19 +172,19 @@ public function testShouldPropagateFlags()
172172
}
173173

174174
/**
175-
* @return \PHPUnit_Framework_MockObject_MockObject|PsrMessage
175+
* @return \PHPUnit_Framework_MockObject_MockObject|Message
176176
*/
177177
private function createMessageMock()
178178
{
179-
return $this->createMock(PsrMessage::class);
179+
return $this->createMock(Message::class);
180180
}
181181

182182
/**
183-
* @return \PHPUnit_Framework_MockObject_MockObject|PsrDestination
183+
* @return \PHPUnit_Framework_MockObject_MockObject|Destination
184184
*/
185185
private function createDestinationMock()
186186
{
187-
return $this->createMock(PsrDestination::class);
187+
return $this->createMock(Destination::class);
188188
}
189189

190190
/**

0 commit comments

Comments
 (0)