Skip to content

Commit 32966b1

Browse files
committed
[amqp-ext] Do not use deprecated classses.
1 parent dc59f95 commit 32966b1

25 files changed

+96
-96
lines changed

pkg/amqp-ext/AmqpConnectionFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Enqueue\AmqpTools\DelayStrategyAwareTrait;
88
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
99
use Interop\Amqp\AmqpConnectionFactory as InteropAmqpConnectionFactory;
10-
use Interop\Queue\PsrContext;
10+
use Interop\Queue\Context;
1111

1212
class AmqpConnectionFactory implements InteropAmqpConnectionFactory, DelayStrategyAware
1313
{
@@ -44,7 +44,7 @@ public function __construct($config = 'amqp:')
4444
/**
4545
* @return AmqpContext
4646
*/
47-
public function createContext(): PsrContext
47+
public function createContext(): Context
4848
{
4949
if ($this->config->isLazy()) {
5050
$context = new AmqpContext(function () {

pkg/amqp-ext/AmqpConsumer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use Interop\Amqp\AmqpConsumer as InteropAmqpConsumer;
66
use Interop\Amqp\AmqpMessage as InteropAmqpMessage;
77
use Interop\Amqp\AmqpQueue as InteropAmqpQueue;
8-
use Interop\Queue\InvalidMessageException;
9-
use Interop\Queue\PsrMessage;
10-
use Interop\Queue\PsrQueue;
8+
use Interop\Queue\Exception\InvalidMessageException;
9+
use Interop\Queue\Message;
10+
use Interop\Queue\Queue;
1111

1212
class AmqpConsumer implements InteropAmqpConsumer
1313
{
@@ -76,15 +76,15 @@ public function setFlags(int $flags): void
7676
/**
7777
* @return InteropAmqpQueue
7878
*/
79-
public function getQueue(): PsrQueue
79+
public function getQueue(): Queue
8080
{
8181
return $this->queue;
8282
}
8383

8484
/**
8585
* @return InteropAmqpMessage
8686
*/
87-
public function receive(int $timeout = 0): ?PsrMessage
87+
public function receive(int $timeout = 0): ?Message
8888
{
8989
$end = microtime(true) + ($timeout / 1000);
9090

@@ -102,7 +102,7 @@ public function receive(int $timeout = 0): ?PsrMessage
102102
/**
103103
* @return InteropAmqpMessage
104104
*/
105-
public function receiveNoWait(): ?PsrMessage
105+
public function receiveNoWait(): ?Message
106106
{
107107
if ($extMessage = $this->getExtQueue()->get(Flags::convertConsumerFlags($this->flags))) {
108108
return $this->context->convertMessage($extMessage);
@@ -114,7 +114,7 @@ public function receiveNoWait(): ?PsrMessage
114114
/**
115115
* @param InteropAmqpMessage $message
116116
*/
117-
public function acknowledge(PsrMessage $message): void
117+
public function acknowledge(Message $message): void
118118
{
119119
InvalidMessageException::assertMessageInstanceOf($message, InteropAmqpMessage::class);
120120

@@ -124,7 +124,7 @@ public function acknowledge(PsrMessage $message): void
124124
/**
125125
* @param InteropAmqpMessage $message
126126
*/
127-
public function reject(PsrMessage $message, bool $requeue = false): void
127+
public function reject(Message $message, bool $requeue = false): void
128128
{
129129
InvalidMessageException::assertMessageInstanceOf($message, InteropAmqpMessage::class);
130130

pkg/amqp-ext/AmqpContext.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
use Interop\Amqp\Impl\AmqpMessage;
1414
use Interop\Amqp\Impl\AmqpQueue;
1515
use Interop\Amqp\Impl\AmqpTopic;
16-
use Interop\Queue\Exception;
17-
use Interop\Queue\InvalidDestinationException;
18-
use Interop\Queue\PsrConsumer;
19-
use Interop\Queue\PsrDestination;
20-
use Interop\Queue\PsrMessage;
21-
use Interop\Queue\PsrProducer;
22-
use Interop\Queue\PsrQueue;
23-
use Interop\Queue\PsrSubscriptionConsumer;
24-
use Interop\Queue\PsrTopic;
16+
use Interop\Queue\Consumer;
17+
use Interop\Queue\Destination;
18+
use Interop\Queue\Exception\Exception;
19+
use Interop\Queue\Exception\InvalidDestinationException;
20+
use Interop\Queue\Message;
21+
use Interop\Queue\Producer;
22+
use Interop\Queue\Queue;
23+
use Interop\Queue\SubscriptionConsumer;
24+
use Interop\Queue\Topic;
2525

2626
class AmqpContext implements InteropAmqpContext, DelayStrategyAware
2727
{
@@ -56,15 +56,15 @@ public function __construct($extChannel)
5656
/**
5757
* @return InteropAmqpMessage
5858
*/
59-
public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage
59+
public function createMessage(string $body = '', array $properties = [], array $headers = []): Message
6060
{
6161
return new AmqpMessage($body, $properties, $headers);
6262
}
6363

6464
/**
6565
* @return InteropAmqpTopic
6666
*/
67-
public function createTopic(string $topicName): PsrTopic
67+
public function createTopic(string $topicName): Topic
6868
{
6969
return new AmqpTopic($topicName);
7070
}
@@ -89,7 +89,7 @@ public function declareTopic(InteropAmqpTopic $topic): void
8989
/**
9090
* @return InteropAmqpQueue
9191
*/
92-
public function createQueue(string $queueName): PsrQueue
92+
public function createQueue(string $queueName): Queue
9393
{
9494
return new AmqpQueue($queueName);
9595
}
@@ -114,7 +114,7 @@ public function declareQueue(InteropAmqpQueue $queue): int
114114
/**
115115
* @param InteropAmqpQueue $queue
116116
*/
117-
public function purgeQueue(PsrQueue $queue): void
117+
public function purgeQueue(Queue $queue): void
118118
{
119119
InvalidDestinationException::assertDestinationInstanceOf($queue, InteropAmqpQueue::class);
120120

@@ -174,7 +174,7 @@ public function unbind(InteropAmqpBind $bind): void
174174
/**
175175
* @return InteropAmqpQueue
176176
*/
177-
public function createTemporaryQueue(): PsrQueue
177+
public function createTemporaryQueue(): Queue
178178
{
179179
$extQueue = new \AMQPQueue($this->getExtChannel());
180180
$extQueue->setFlags(AMQP_EXCLUSIVE);
@@ -190,7 +190,7 @@ public function createTemporaryQueue(): PsrQueue
190190
/**
191191
* @return AmqpProducer
192192
*/
193-
public function createProducer(): PsrProducer
193+
public function createProducer(): Producer
194194
{
195195
$producer = new AmqpProducer($this->getExtChannel(), $this);
196196
$producer->setDelayStrategy($this->delayStrategy);
@@ -203,9 +203,9 @@ public function createProducer(): PsrProducer
203203
*
204204
* @return AmqpConsumer
205205
*/
206-
public function createConsumer(PsrDestination $destination): PsrConsumer
206+
public function createConsumer(Destination $destination): Consumer
207207
{
208-
$destination instanceof PsrTopic
208+
$destination instanceof Topic
209209
? InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpTopic::class)
210210
: InvalidDestinationException::assertDestinationInstanceOf($destination, InteropAmqpQueue::class)
211211
;
@@ -220,7 +220,7 @@ public function createConsumer(PsrDestination $destination): PsrConsumer
220220
return new AmqpConsumer($this, $destination);
221221
}
222222

223-
public function createSubscriptionConsumer(): PsrSubscriptionConsumer
223+
public function createSubscriptionConsumer(): SubscriptionConsumer
224224
{
225225
return new AmqpSubscriptionConsumer($this);
226226
}

pkg/amqp-ext/AmqpProducer.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
use Interop\Amqp\AmqpProducer as InteropAmqpProducer;
1010
use Interop\Amqp\AmqpQueue;
1111
use Interop\Amqp\AmqpTopic;
12-
use Interop\Queue\DeliveryDelayNotSupportedException;
13-
use Interop\Queue\Exception;
14-
use Interop\Queue\InvalidDestinationException;
15-
use Interop\Queue\InvalidMessageException;
16-
use Interop\Queue\PsrDestination;
17-
use Interop\Queue\PsrMessage;
18-
use Interop\Queue\PsrProducer;
19-
use Interop\Queue\PsrTopic;
12+
use Interop\Queue\Destination;
13+
use Interop\Queue\Exception\DeliveryDelayNotSupportedException;
14+
use Interop\Queue\Exception\Exception;
15+
use Interop\Queue\Exception\InvalidDestinationException;
16+
use Interop\Queue\Exception\InvalidMessageException;
17+
use Interop\Queue\Message;
18+
use Interop\Queue\Producer;
19+
use Interop\Queue\Topic;
2020

2121
class AmqpProducer implements InteropAmqpProducer, DelayStrategyAware
2222
{
@@ -57,9 +57,9 @@ public function __construct(\AMQPChannel $ampqChannel, AmqpContext $context)
5757
* @param AmqpTopic|AmqpQueue $destination
5858
* @param AmqpMessage $message
5959
*/
60-
public function send(PsrDestination $destination, PsrMessage $message): void
60+
public function send(Destination $destination, Message $message): void
6161
{
62-
$destination instanceof PsrTopic
62+
$destination instanceof Topic
6363
? InvalidDestinationException::assertDestinationInstanceOf($destination, AmqpTopic::class)
6464
: InvalidDestinationException::assertDestinationInstanceOf($destination, AmqpQueue::class);
6565

@@ -72,7 +72,7 @@ public function send(PsrDestination $destination, PsrMessage $message): void
7272
}
7373
}
7474

75-
public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer
75+
public function setDeliveryDelay(int $deliveryDelay = null): Producer
7676
{
7777
if (null === $this->delayStrategy) {
7878
throw DeliveryDelayNotSupportedException::providerDoestNotSupportIt();
@@ -88,7 +88,7 @@ public function getDeliveryDelay(): ?int
8888
return $this->deliveryDelay;
8989
}
9090

91-
public function setPriority(int $priority = null): PsrProducer
91+
public function setPriority(int $priority = null): Producer
9292
{
9393
$this->priority = $priority;
9494

@@ -100,7 +100,7 @@ public function getPriority(): ?int
100100
return $this->priority;
101101
}
102102

103-
public function setTimeToLive(int $timeToLive = null): PsrProducer
103+
public function setTimeToLive(int $timeToLive = null): Producer
104104
{
105105
$this->timeToLive = $timeToLive;
106106

pkg/amqp-ext/AmqpSubscriptionConsumer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Enqueue\AmqpExt;
44

55
use Interop\Amqp\AmqpSubscriptionConsumer as InteropAmqpSubscriptionConsumer;
6-
use Interop\Queue\PsrConsumer;
6+
use Interop\Queue\Consumer;
77

88
class AmqpSubscriptionConsumer implements InteropAmqpSubscriptionConsumer
99
{
@@ -83,7 +83,7 @@ public function consume(int $timeout = 0): void
8383
/**
8484
* @param AmqpConsumer $consumer
8585
*/
86-
public function subscribe(PsrConsumer $consumer, callable $callback): void
86+
public function subscribe(Consumer $consumer, callable $callback): void
8787
{
8888
if (false == $consumer instanceof AmqpConsumer) {
8989
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));
@@ -106,7 +106,7 @@ public function subscribe(PsrConsumer $consumer, callable $callback): void
106106
/**
107107
* @param AmqpConsumer $consumer
108108
*/
109-
public function unsubscribe(PsrConsumer $consumer): void
109+
public function unsubscribe(Consumer $consumer): void
110110
{
111111
if (false == $consumer instanceof AmqpConsumer) {
112112
throw new \InvalidArgumentException(sprintf('The consumer must be instance of "%s" got "%s"', AmqpConsumer::class, get_class($consumer)));

pkg/amqp-ext/Tests/AmqpConnectionFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Enqueue\AmqpExt\AmqpContext;
77
use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy;
88
use Enqueue\Test\ClassExtensionTrait;
9-
use Interop\Queue\PsrConnectionFactory;
9+
use Interop\Queue\ConnectionFactory;
1010
use PHPUnit\Framework\TestCase;
1111

1212
class AmqpConnectionFactoryTest extends TestCase
@@ -15,7 +15,7 @@ class AmqpConnectionFactoryTest extends TestCase
1515

1616
public function testShouldImplementConnectionFactoryInterface()
1717
{
18-
$this->assertClassImplements(PsrConnectionFactory::class, AmqpConnectionFactory::class);
18+
$this->assertClassImplements(ConnectionFactory::class, AmqpConnectionFactory::class);
1919
}
2020

2121
public function testShouldSetRabbitMqDlxDelayStrategyIfRabbitMqSchemeExtensionPresent()

pkg/amqp-ext/Tests/AmqpConsumerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Enqueue\AmqpExt\AmqpContext;
77
use Enqueue\Test\ClassExtensionTrait;
88
use Interop\Amqp\Impl\AmqpQueue;
9-
use Interop\Queue\PsrConsumer;
9+
use Interop\Queue\Consumer;
1010
use PHPUnit\Framework\TestCase;
1111

1212
class AmqpConsumerTest extends TestCase
@@ -15,7 +15,7 @@ class AmqpConsumerTest extends TestCase
1515

1616
public function testShouldImplementConsumerInterface()
1717
{
18-
$this->assertClassImplements(PsrConsumer::class, AmqpConsumer::class);
18+
$this->assertClassImplements(Consumer::class, AmqpConsumer::class);
1919
}
2020

2121
public function testCouldBeConstructedWithContextAndQueueAsArguments()

pkg/amqp-ext/Tests/AmqpContextTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
use Interop\Amqp\Impl\AmqpMessage;
1313
use Interop\Amqp\Impl\AmqpQueue;
1414
use Interop\Amqp\Impl\AmqpTopic;
15-
use Interop\Queue\InvalidDestinationException;
16-
use Interop\Queue\PsrContext;
15+
use Interop\Queue\Context;
16+
use Interop\Queue\Exception\InvalidDestinationException;
1717
use PHPUnit\Framework\TestCase;
1818

1919
class AmqpContextTest extends TestCase
2020
{
2121
use ClassExtensionTrait;
2222

23-
public function testShouldImplementPsrContextInterface()
23+
public function testShouldImplementQueueInteropContextInterface()
2424
{
25-
$this->assertClassImplements(PsrContext::class, AmqpContext::class);
25+
$this->assertClassImplements(Context::class, AmqpContext::class);
2626
}
2727

2828
public function testCouldBeConstructedWithExtChannelAsFirstArgument()

pkg/amqp-ext/Tests/AmqpProducerTest.php

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

55
use Enqueue\AmqpExt\AmqpProducer;
66
use Enqueue\Test\ClassExtensionTrait;
7-
use Interop\Queue\PsrProducer;
7+
use Interop\Queue\Producer;
88
use PHPUnit\Framework\TestCase;
99

1010
class AmqpProducerTest extends TestCase
@@ -13,6 +13,6 @@ class AmqpProducerTest extends TestCase
1313

1414
public function testShouldImplementProducerInterface()
1515
{
16-
$this->assertClassImplements(PsrProducer::class, AmqpProducer::class);
16+
$this->assertClassImplements(Producer::class, AmqpProducer::class);
1717
}
1818
}

pkg/amqp-ext/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\AmqpExt\AmqpContext;
66
use Enqueue\AmqpExt\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()

0 commit comments

Comments
 (0)