Skip to content

Commit 15a75e1

Browse files
committed
[simple-client] Do not use deprecated classes.
1 parent 7fc1e85 commit 15a75e1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pkg/simple-client/SimpleClient.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
use Enqueue\Rpc\Promise;
2626
use Enqueue\Rpc\RpcFactory;
2727
use Enqueue\Symfony\DependencyInjection\TransportFactory;
28-
use Interop\Queue\PsrProcessor;
28+
use Interop\Queue\Processor;
2929
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
3030
use Symfony\Component\Config\Definition\NodeInterface;
31-
use Symfony\Component\Config\Definition\Processor;
31+
use Symfony\Component\Config\Definition\Processor as ConfigProcessor;
3232

3333
final class SimpleClient
3434
{
@@ -110,16 +110,16 @@ public function __construct($config)
110110
}
111111

112112
/**
113-
* @param callable|PsrProcessor $processor
113+
* @param callable|Processor $processor
114114
*/
115115
public function bindTopic(string $topic, $processor, string $processorName = null): void
116116
{
117117
if (is_callable($processor)) {
118118
$processor = new CallbackProcessor($processor);
119119
}
120120

121-
if (false == $processor instanceof PsrProcessor) {
122-
throw new \LogicException('The processor must be either callable or instance of PsrProcessor');
121+
if (false == $processor instanceof Processor) {
122+
throw new \LogicException('The processor must be either callable or instance of Processor');
123123
}
124124

125125
$processorName = $processorName ?: uniqid(get_class($processor));
@@ -129,16 +129,16 @@ public function bindTopic(string $topic, $processor, string $processorName = nul
129129
}
130130

131131
/**
132-
* @param callable|PsrProcessor $processor
132+
* @param callable|Processor $processor
133133
*/
134134
public function bindCommand(string $command, $processor, string $processorName = null): void
135135
{
136136
if (is_callable($processor)) {
137137
$processor = new CallbackProcessor($processor);
138138
}
139139

140-
if (false == $processor instanceof PsrProcessor) {
141-
throw new \LogicException('The processor must be either callable or instance of PsrProcessor');
140+
if (false == $processor instanceof Processor) {
141+
throw new \LogicException('The processor must be either callable or instance of Processor');
142142
}
143143

144144
$processorName = $processorName ?: uniqid(get_class($processor));
@@ -211,7 +211,7 @@ public function setupBroker(): void
211211

212212
public function build(array $configs): void
213213
{
214-
$configProcessor = new Processor();
214+
$configProcessor = new ConfigProcessor();
215215
$simpleClientConfig = $configProcessor->process($this->createConfiguration(), $configs);
216216

217217
if (isset($simpleClientConfig['transport']['factory_service'])) {

pkg/simple-client/Tests/Functional/SimpleClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use Enqueue\Consumption\Extension\LimitConsumptionTimeExtension;
88
use Enqueue\Consumption\Result;
99
use Enqueue\SimpleClient\SimpleClient;
10-
use Interop\Queue\PsrMessage;
11-
use Interop\Queue\PurgeQueueNotSupportedException;
10+
use Interop\Queue\Exception\PurgeQueueNotSupportedException;
11+
use Interop\Queue\Message;
1212
use PHPUnit\Framework\TestCase;
1313

1414
/**
@@ -75,7 +75,7 @@ public function testSendEventWithOneSubscriber(array $config, string $timeLimit)
7575

7676
$client = new SimpleClient($config);
7777

78-
$client->bindTopic('foo_topic', function (PsrMessage $message) use (&$actualMessage) {
78+
$client->bindTopic('foo_topic', function (Message $message) use (&$actualMessage) {
7979
$actualMessage = $message;
8080

8181
return Result::ACK;
@@ -92,7 +92,7 @@ public function testSendEventWithOneSubscriber(array $config, string $timeLimit)
9292
new LimitConsumedMessagesExtension(2),
9393
]));
9494

95-
$this->assertInstanceOf(PsrMessage::class, $actualMessage);
95+
$this->assertInstanceOf(Message::class, $actualMessage);
9696
$this->assertSame('Hello there!', $actualMessage->getBody());
9797
}
9898

0 commit comments

Comments
 (0)