Skip to content

Commit 8e24a4a

Browse files
committed
[pheastalk] Do not use depreacted classes.
1 parent 831c366 commit 8e24a4a

13 files changed

+77
-77
lines changed

PheanstalkConnectionFactory.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\PsrConnectionFactory;
8-
use Interop\Queue\PsrContext;
7+
use Interop\Queue\ConnectionFactory;
8+
use Interop\Queue\Context;
99
use Pheanstalk\Pheanstalk;
1010

11-
class PheanstalkConnectionFactory implements PsrConnectionFactory
11+
class PheanstalkConnectionFactory implements ConnectionFactory
1212
{
1313
/**
1414
* @var array
@@ -54,7 +54,7 @@ public function __construct($config = 'beanstalk:')
5454
/**
5555
* @return PheanstalkContext
5656
*/
57-
public function createContext(): PsrContext
57+
public function createContext(): Context
5858
{
5959
return new PheanstalkContext($this->establishConnection());
6060
}

PheanstalkConsumer.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\InvalidMessageException;
8-
use Interop\Queue\PsrConsumer;
9-
use Interop\Queue\PsrMessage;
10-
use Interop\Queue\PsrQueue;
7+
use Interop\Queue\Consumer;
8+
use Interop\Queue\Exception\InvalidMessageException;
9+
use Interop\Queue\Message;
10+
use Interop\Queue\Queue;
1111
use Pheanstalk\Job;
1212
use Pheanstalk\Pheanstalk;
1313

14-
class PheanstalkConsumer implements PsrConsumer
14+
class PheanstalkConsumer implements Consumer
1515
{
1616
/**
1717
* @var PheanstalkDestination
@@ -32,15 +32,15 @@ public function __construct(PheanstalkDestination $destination, Pheanstalk $phea
3232
/**
3333
* @return PheanstalkDestination
3434
*/
35-
public function getQueue(): PsrQueue
35+
public function getQueue(): Queue
3636
{
3737
return $this->destination;
3838
}
3939

4040
/**
4141
* @return PheanstalkMessage
4242
*/
43-
public function receive(int $timeout = 0): ?PsrMessage
43+
public function receive(int $timeout = 0): ?Message
4444
{
4545
if (0 === $timeout) {
4646
while (true) {
@@ -60,7 +60,7 @@ public function receive(int $timeout = 0): ?PsrMessage
6060
/**
6161
* @return PheanstalkMessage
6262
*/
63-
public function receiveNoWait(): ?PsrMessage
63+
public function receiveNoWait(): ?Message
6464
{
6565
if ($job = $this->pheanstalk->reserveFromTube($this->destination->getName(), 0)) {
6666
return $this->convertJobToMessage($job);
@@ -72,7 +72,7 @@ public function receiveNoWait(): ?PsrMessage
7272
/**
7373
* @param PheanstalkMessage $message
7474
*/
75-
public function acknowledge(PsrMessage $message): void
75+
public function acknowledge(Message $message): void
7676
{
7777
InvalidMessageException::assertMessageInstanceOf($message, PheanstalkMessage::class);
7878

@@ -86,7 +86,7 @@ public function acknowledge(PsrMessage $message): void
8686
/**
8787
* @param PheanstalkMessage $message
8888
*/
89-
public function reject(PsrMessage $message, bool $requeue = false): void
89+
public function reject(Message $message, bool $requeue = false): void
9090
{
9191
$this->acknowledge($message);
9292

PheanstalkContext.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\InvalidDestinationException;
8-
use Interop\Queue\PsrConsumer;
9-
use Interop\Queue\PsrContext;
10-
use Interop\Queue\PsrDestination;
11-
use Interop\Queue\PsrMessage;
12-
use Interop\Queue\PsrProducer;
13-
use Interop\Queue\PsrQueue;
14-
use Interop\Queue\PsrSubscriptionConsumer;
15-
use Interop\Queue\PsrTopic;
16-
use Interop\Queue\PurgeQueueNotSupportedException;
17-
use Interop\Queue\SubscriptionConsumerNotSupportedException;
18-
use Interop\Queue\TemporaryQueueNotSupportedException;
7+
use Interop\Queue\Consumer;
8+
use Interop\Queue\Context;
9+
use Interop\Queue\Destination;
10+
use Interop\Queue\Exception\InvalidDestinationException;
11+
use Interop\Queue\Exception\PurgeQueueNotSupportedException;
12+
use Interop\Queue\Exception\SubscriptionConsumerNotSupportedException;
13+
use Interop\Queue\Exception\TemporaryQueueNotSupportedException;
14+
use Interop\Queue\Message;
15+
use Interop\Queue\Producer;
16+
use Interop\Queue\Queue;
17+
use Interop\Queue\SubscriptionConsumer;
18+
use Interop\Queue\Topic;
1919
use Pheanstalk\Pheanstalk;
2020

21-
class PheanstalkContext implements PsrContext
21+
class PheanstalkContext implements Context
2222
{
2323
/**
2424
* @var Pheanstalk
@@ -33,36 +33,36 @@ public function __construct(Pheanstalk $pheanstalk)
3333
/**
3434
* @return PheanstalkMessage
3535
*/
36-
public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage
36+
public function createMessage(string $body = '', array $properties = [], array $headers = []): Message
3737
{
3838
return new PheanstalkMessage($body, $properties, $headers);
3939
}
4040

4141
/**
4242
* @return PheanstalkDestination
4343
*/
44-
public function createTopic(string $topicName): PsrTopic
44+
public function createTopic(string $topicName): Topic
4545
{
4646
return new PheanstalkDestination($topicName);
4747
}
4848

4949
/**
5050
* @return PheanstalkDestination
5151
*/
52-
public function createQueue(string $queueName): PsrQueue
52+
public function createQueue(string $queueName): Queue
5353
{
5454
return new PheanstalkDestination($queueName);
5555
}
5656

57-
public function createTemporaryQueue(): PsrQueue
57+
public function createTemporaryQueue(): Queue
5858
{
5959
throw TemporaryQueueNotSupportedException::providerDoestNotSupportIt();
6060
}
6161

6262
/**
6363
* @return PheanstalkProducer
6464
*/
65-
public function createProducer(): PsrProducer
65+
public function createProducer(): Producer
6666
{
6767
return new PheanstalkProducer($this->pheanstalk);
6868
}
@@ -72,7 +72,7 @@ public function createProducer(): PsrProducer
7272
*
7373
* @return PheanstalkConsumer
7474
*/
75-
public function createConsumer(PsrDestination $destination): PsrConsumer
75+
public function createConsumer(Destination $destination): Consumer
7676
{
7777
InvalidDestinationException::assertDestinationInstanceOf($destination, PheanstalkDestination::class);
7878

@@ -84,12 +84,12 @@ public function close(): void
8484
$this->pheanstalk->getConnection()->disconnect();
8585
}
8686

87-
public function createSubscriptionConsumer(): PsrSubscriptionConsumer
87+
public function createSubscriptionConsumer(): SubscriptionConsumer
8888
{
8989
throw SubscriptionConsumerNotSupportedException::providerDoestNotSupportIt();
9090
}
9191

92-
public function purgeQueue(PsrQueue $queue): void
92+
public function purgeQueue(Queue $queue): void
9393
{
9494
throw PurgeQueueNotSupportedException::providerDoestNotSupportIt();
9595
}

PheanstalkDestination.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\PsrQueue;
8-
use Interop\Queue\PsrTopic;
7+
use Interop\Queue\Queue;
8+
use Interop\Queue\Topic;
99

10-
class PheanstalkDestination implements PsrQueue, PsrTopic
10+
class PheanstalkDestination implements Queue, Topic
1111
{
1212
/**
1313
* @var string

PheanstalkMessage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\PsrMessage;
7+
use Interop\Queue\Message;
88
use Pheanstalk\Job;
99
use Pheanstalk\Pheanstalk;
1010

11-
class PheanstalkMessage implements PsrMessage, \JsonSerializable
11+
class PheanstalkMessage implements Message, \JsonSerializable
1212
{
1313
/**
1414
* @var string

PheanstalkProducer.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace Enqueue\Pheanstalk;
66

7-
use Interop\Queue\InvalidDestinationException;
8-
use Interop\Queue\InvalidMessageException;
9-
use Interop\Queue\PsrDestination;
10-
use Interop\Queue\PsrMessage;
11-
use Interop\Queue\PsrProducer;
7+
use Interop\Queue\Destination;
8+
use Interop\Queue\Exception\InvalidDestinationException;
9+
use Interop\Queue\Exception\InvalidMessageException;
10+
use Interop\Queue\Message;
11+
use Interop\Queue\Producer;
1212
use Pheanstalk\Pheanstalk;
1313

14-
class PheanstalkProducer implements PsrProducer
14+
class PheanstalkProducer implements Producer
1515
{
1616
/**
1717
* @var Pheanstalk
@@ -27,7 +27,7 @@ public function __construct(Pheanstalk $pheanstalk)
2727
* @param PheanstalkDestination $destination
2828
* @param PheanstalkMessage $message
2929
*/
30-
public function send(PsrDestination $destination, PsrMessage $message): void
30+
public function send(Destination $destination, Message $message): void
3131
{
3232
InvalidDestinationException::assertDestinationInstanceOf($destination, PheanstalkDestination::class);
3333
InvalidMessageException::assertMessageInstanceOf($message, PheanstalkMessage::class);
@@ -52,7 +52,7 @@ public function send(PsrDestination $destination, PsrMessage $message): void
5252
/**
5353
* @return PheanstalkProducer
5454
*/
55-
public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer
55+
public function setDeliveryDelay(int $deliveryDelay = null): Producer
5656
{
5757
if (null === $deliveryDelay) {
5858
return $this;
@@ -69,7 +69,7 @@ public function getDeliveryDelay(): ?int
6969
/**
7070
* @return PheanstalkProducer
7171
*/
72-
public function setPriority(int $priority = null): PsrProducer
72+
public function setPriority(int $priority = null): Producer
7373
{
7474
if (null === $priority) {
7575
return $this;
@@ -86,7 +86,7 @@ public function getPriority(): ?int
8686
/**
8787
* @return PheanstalkProducer
8888
*/
89-
public function setTimeToLive(int $timeToLive = null): PsrProducer
89+
public function setTimeToLive(int $timeToLive = null): Producer
9090
{
9191
if (null === $timeToLive) {
9292
return $this;

Tests/PheanstalkContextTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use Enqueue\Null\NullQueue;
66
use Enqueue\Pheanstalk\PheanstalkContext;
77
use Enqueue\Test\ClassExtensionTrait;
8-
use Interop\Queue\InvalidDestinationException;
9-
use Interop\Queue\PsrContext;
10-
use Interop\Queue\TemporaryQueueNotSupportedException;
8+
use Interop\Queue\Context;
9+
use Interop\Queue\Exception\InvalidDestinationException;
10+
use Interop\Queue\Exception\TemporaryQueueNotSupportedException;
1111
use Pheanstalk\Connection;
1212
use Pheanstalk\Pheanstalk;
1313
use PHPUnit\Framework\TestCase;
@@ -16,9 +16,9 @@ class PheanstalkContextTest extends TestCase
1616
{
1717
use ClassExtensionTrait;
1818

19-
public function testShouldImplementPsrContextInterface()
19+
public function testShouldImplementContextInterface()
2020
{
21-
$this->assertClassImplements(PsrContext::class, PheanstalkContext::class);
21+
$this->assertClassImplements(Context::class, PheanstalkContext::class);
2222
}
2323

2424
public function testCouldBeConstructedWithPheanstalkAsFirstArgument()

Tests/PheanstalkDestinationTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55
use Enqueue\Pheanstalk\PheanstalkDestination;
66
use Enqueue\Test\ClassExtensionTrait;
7-
use Interop\Queue\PsrQueue;
8-
use Interop\Queue\PsrTopic;
7+
use Interop\Queue\Queue;
8+
use Interop\Queue\Topic;
99
use PHPUnit\Framework\TestCase;
1010

1111
class PheanstalkDestinationTest extends TestCase
1212
{
1313
use ClassExtensionTrait;
1414

15-
public function testShouldImplementPsrQueueInterface()
15+
public function testShouldImplementQueueInterface()
1616
{
17-
$this->assertClassImplements(PsrQueue::class, PheanstalkDestination::class);
17+
$this->assertClassImplements(Queue::class, PheanstalkDestination::class);
1818
}
1919

20-
public function testShouldImplementPsrTopicInterface()
20+
public function testShouldImplementTopicInterface()
2121
{
22-
$this->assertClassImplements(PsrTopic::class, PheanstalkDestination::class);
22+
$this->assertClassImplements(Topic::class, PheanstalkDestination::class);
2323
}
2424

2525
public function testShouldAllowGetNameSetInConstructor()

Tests/PheanstalkProducerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use Enqueue\Pheanstalk\PheanstalkMessage;
99
use Enqueue\Pheanstalk\PheanstalkProducer;
1010
use Enqueue\Test\ClassExtensionTrait;
11-
use Interop\Queue\InvalidDestinationException;
12-
use Interop\Queue\InvalidMessageException;
11+
use Interop\Queue\Exception\InvalidDestinationException;
12+
use Interop\Queue\Exception\InvalidMessageException;
1313
use Pheanstalk\Pheanstalk;
1414
use PHPUnit\Framework\TestCase;
1515

Tests/Spec/PheanstalkSendToAndReceiveFromQueueTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Enqueue\Pheanstalk\Tests\Spec;
44

55
use Enqueue\Pheanstalk\PheanstalkConnectionFactory;
6-
use Interop\Queue\PsrContext;
7-
use Interop\Queue\PsrQueue;
6+
use Interop\Queue\Context;
7+
use Interop\Queue\Queue;
88
use Interop\Queue\Spec\SendToAndReceiveFromQueueSpec;
99

1010
/**
@@ -23,12 +23,12 @@ protected function createContext()
2323
}
2424

2525
/**
26-
* @param PsrContext $context
27-
* @param string $queueName
26+
* @param Context $context
27+
* @param string $queueName
2828
*
29-
* @return PsrQueue
29+
* @return Queue
3030
*/
31-
protected function createQueue(PsrContext $context, $queueName)
31+
protected function createQueue(Context $context, $queueName)
3232
{
3333
return $context->createQueue($queueName.time());
3434
}

Tests/Spec/PheanstalkSendToAndReceiveNoWaitFromQueueTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Enqueue\Pheanstalk\Tests\Spec;
44

55
use Enqueue\Pheanstalk\PheanstalkConnectionFactory;
6-
use Interop\Queue\PsrContext;
6+
use Interop\Queue\Context;
77
use Interop\Queue\Spec\SendToAndReceiveNoWaitFromQueueSpec;
88

99
/**
@@ -24,7 +24,7 @@ protected function createContext()
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
protected function createQueue(PsrContext $context, $queueName)
27+
protected function createQueue(Context $context, $queueName)
2828
{
2929
return $context->createQueue($queueName.time());
3030
}

0 commit comments

Comments
 (0)