Skip to content

Commit 7880d66

Browse files
committed
[amqp-bunny] Do not use Psr prefixed deprecated classes.
1 parent 3fcc124 commit 7880d66

23 files changed

Lines changed: 88 additions & 88 deletions

‎pkg/amqp-bunny/AmqpConnectionFactory.php‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 11 additions & 11 deletions
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‎

Lines changed: 20 additions & 20 deletions
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‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
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;
15+
use Interop\Queue\Exception\DeliveryDelayNotSupportedException;
16+
use Interop\Queue\Exception\Exception;
17+
use Interop\Queue\Exception\InvalidDestinationException;
18+
use Interop\Queue\Exception\InvalidMessageException;
1919
use Interop\Queue\PsrDestination;
2020
use Interop\Queue\PsrMessage;
2121
use Interop\Queue\PsrProducer;

‎pkg/amqp-bunny/AmqpSubscriptionConsumer.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Enqueue\AmqpTools\SignalSocketHelper;
1212
use Interop\Amqp\AmqpConsumer as InteropAmqpConsumer;
1313
use Interop\Amqp\AmqpSubscriptionConsumer as InteropAmqpSubscriptionConsumer;
14-
use Interop\Queue\Exception;
14+
use Interop\Queue\Exception\Exception;
1515
use Interop\Queue\PsrConsumer;
1616

1717
class AmqpSubscriptionConsumer implements InteropAmqpSubscriptionConsumer

‎pkg/amqp-bunny/Tests/AmqpConnectionFactoryTest.php‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 3 additions & 3 deletions
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‎

Lines changed: 12 additions & 12 deletions
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
/**

‎pkg/amqp-bunny/Tests/AmqpSubscriptionConsumerTest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
use Enqueue\AmqpBunny\AmqpContext;
66
use Enqueue\AmqpBunny\AmqpSubscriptionConsumer;
7-
use Interop\Queue\PsrSubscriptionConsumer;
7+
use Interop\Queue\SubscriptionConsumer;
88
use PHPUnit\Framework\TestCase;
99

1010
class AmqpSubscriptionConsumerTest extends TestCase
1111
{
12-
public function testShouldImplementPsrSubscriptionConsumerInterface()
12+
public function testShouldImplementQueueInteropSubscriptionConsumerInterface()
1313
{
1414
$rc = new \ReflectionClass(AmqpSubscriptionConsumer::class);
1515

16-
$this->assertTrue($rc->implementsInterface(PsrSubscriptionConsumer::class));
16+
$this->assertTrue($rc->implementsInterface(SubscriptionConsumer::class));
1717
}
1818

1919
public function testCouldBeConstructedWithAmqpContextAsFirstArgument()

‎pkg/amqp-bunny/Tests/Spec/AmqpSendAndReceiveDelayedMessageWithDelayPluginStrategyTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Enqueue\AmqpBunny\AmqpConnectionFactory;
66
use Enqueue\AmqpBunny\AmqpContext;
77
use Enqueue\AmqpTools\RabbitMqDelayPluginDelayStrategy;
8-
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Context;
99
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
1010

1111
/**
@@ -34,7 +34,7 @@ protected function createContext()
3434
*
3535
* {@inheritdoc}
3636
*/
37-
protected function createQueue(PsrContext $context, $queueName)
37+
protected function createQueue(Context $context, $queueName)
3838
{
3939
$queue = parent::createQueue($context, $queueName);
4040

0 commit comments

Comments
 (0)