8000 [Messenger] Removed deprecated code · symfony/symfony@b4b48c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit b4b48c1

Browse files
committed
[Messenger] Removed deprecated code
1 parent 1cec4a5 commit b4b48c1

File tree

7 files changed

+27
-57
lines changed

7 files changed

+27
-57
lines changed

src/Symfony/Component/Messenger/Bridge/Amqp/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove option `prefetch_count`.
8+
* Using invalid options will throw an `LogicException`.
9+
410
5.3
511
---
612

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class Connection
4343
'exchange',
4444
'delay',
4545
'auto_setup',
46-
'prefetch_count',
4746
'retry',
4847
'persistent',
4948
'frame_max',
@@ -234,11 +233,7 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am
234233
private static function validateOptions(array $options): void
235234
{
236235
if (0 < \count($invalidOptions = array_diff(array_keys($options), self::AVAILABLE_OPTIONS))) {
237-
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
238-
}
239-
240-
if (isset($options['prefetch_count'])) {
241-
trigger_deprecation('symfony/messenger', '5.3', 'The "prefetch_count" option passed to the AMQP Messenger transport has no effect and should not be used.');
236+
throw new LogicException(sprintf('Invalid option(s) "%s" passed to the AMQP Messenger transport.', implode('", "', $invalidOptions)));
242237
}
243238

244239
if (\is_array($options['queues'] ?? false)) {
@@ -248,14 +243,14 @@ private static function validateOptions(array $options): void
248243
}
249244

250245
if (0 < \count($invalidQueueOptions = array_diff(array_keys($queue), self::AVAILABLE_QUEUE_OPTIONS))) {
251-
trigger_deprecation('symfony/messenger', '5.1', 'Invalid queue option(s) "%s" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated.', implode('", "', $invalidQueueOptions));
246+
throw new LogicException(sprintf('Invalid queue option(s) "%s" passed to the AMQP Messenger transport.', implode('", "', $invalidQueueOptions)));
252247
}
253248
}
254249
}
255250

256251
if (\is_array($options['exchange'] ?? false)
257252
&& 0 < \count($invalidExchangeOptions = array_diff(array_keys($options['exchange']), self::AVAILABLE_EXCHANGE_OPTIONS))) {
258-
trigger_deprecation('symfony/messenger', '5.1', 'Invalid exchange option(s) "%s" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated.', implode('", "', $invalidExchangeOptions));
253+
throw new LogicException(sprintf('Invalid exchange option(s) "%s" passed to the AMQP Messenger transport.', implode('", "', $invalidExchangeOptions)));
259254
}
260255
}
261256

src/Symfony/Component/Messenger/Bridge/Redis/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove option `tls`.
8+
* Using invalid options will throw an `LogicException`.
9+
410
5.3
511
---
612

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class Connection
3636
'delete_after_reject' => true,
3737
'stream_max_entries' => 0, // any value higher than 0 defines an approximate maximum number of stream entries
3838
'dbindex' => 0,
39-
'tls' => false,
4039
'redeliver_timeout' => 3600, // Timeout before redeliver messages still in pending state (seconds)
4140
'claim_interval' => 60000, // Interval by which pending/abandoned messages should be checked
4241
'lazy' => false,
@@ -195,11 +194,6 @@ public static function fromDsn(string $dsn, array $redisOptions = [], $redis = n
195194
}
196195

197196
$tls = 'rediss' === $parsedUrl['scheme'];
198-
if (\array_key_exists('tls', $redisOptions)) {
199-
trigger_deprecation('symfony/redis-messenger', '5.3', 'Providing "tls" parameter is deprecated, use "rediss://" DSN scheme instead');
200-
$tls = filter_var($redisOptions['tls'], \FILTER_VALIDATE_BOOLEAN);
201-
unset($redisOptions['tls']);
202-
}
203197

204198
$redeliverTimeout = null;
205199
if (\array_key_exists('redeliver_timeout', $redisOptions)) {
@@ -278,7 +272,7 @@ private static function validateOptions(array $options): void
278272
$availableOptions[] = 'serializer';
279273

280274
if (0 < \count($invalidOptions = array_diff(array_keys($options), $availableOptions))) {
281-
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the Redis Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
275+
throw new LogicException(sprintf('Invalid option(s) "%s" passed to the Redis Messenger transport.', implode('", "', $invalidOptions)));
282276
}
283277
}
284278

src/Symfony/Component/Messenger/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Class `MessengerPass` cannot be configured with constructor arguments.
8+
* Remove constructor arguments and getters for `RedeliveryStamp`'s properties `exceptionMessage` and `flattenException`
9+
410
5.3
511
---
612

src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ class MessengerPass implements CompilerPassInterface
3434
private $busTag;
3535
private $receiverTag;
3636

37-
public function __construct(string $handlerTag = 'messenger.message_handler', string $busTag = 'messenger.bus', string $receiverTag = 'messenger.receiver')
37+
public function __construct()
3838
{
39-
if (0 < \func_num_args()) {
40-
trigger_deprecation('symfony/messenger', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
41-
}
42-
43-
$this->handlerTag = $handlerTag;
44-
$this->busTag = $busTag;
45-
$this->receiverTag = $receiverTag;
39+
$this->handlerTag = 'messenger.message_handler';
40+
$this->busTag = 'messenger.bus';
41+
$this->receiverTag = 'messenger.receiver';
4642
}
4743

4844
/**

src/Symfony/Component/Messenger/Stamp/RedeliveryStamp.php

+1-34
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Messenger\Stamp;
1313

14-
use Symfony\Component\ErrorHandler\Exception\FlattenException;
1514
use Symfony\Component\Messenger\Envelope;
1615

1716
/**
@@ -21,23 +20,11 @@ final class RedeliveryStamp implements StampInterface
2120
{
2221
private $retryCount;
2322
private $redeliveredAt;
24-
private $exceptionMessage;
25-
private $flattenException;
2623

27-
public function __construct(int $retryCount, string $exceptionMessage = null, FlattenException $flattenException = null, \DateTimeInterface $redeliveredAt = null)
24+
public function __construct(int $retryCount, \DateTimeInterface $redeliveredAt = null)
2825
{
2926
$this->retryCount = $retryCount;
3027
$this->redeliveredAt = $redeliveredAt ?? new \DateTimeImmutable();
31-
32-
if (null !== $exceptionMessage) {
33-
trigger_deprecation('symfony/messenger', '5.2', sprintf('Using the "$exceptionMessage" parameter in the "%s" class is deprecated, use the "%s" class instead.', self::class, ErrorDetailsStamp::class));
34-
}
35-
$this->exceptionMessage = $exceptionMessage;
36-
37-
if (null !== $flattenException) {
38-
trigger_deprecation('symfony/messenger', '5.2', sprintf('Using the "$flattenException" parameter in the "%s" class is deprecated, use the "%s" class instead.', self::class, ErrorDetailsStamp::class));
39-
}
40-
$this->flattenException = $flattenException;
4128
}
4229

4330
public static function getRetryCountFromEnvelope(Envelope $envelope): int
@@ -53,26 +40,6 @@ public function getRetryCount(): int
5340
return $this->retryCount;
5441
}
5542

56-
/**
57-
* @deprecated since Symfony 5.2, use ErrorDetailsStamp instead.
58-
*/
59-
public function getExceptionMessage(): ?string
60-
{
61-
trigger_deprecation('symfony/messenger', '5.2', sprintf('Using the "getExceptionMessage()" method of the "%s" class is deprecated, use the "%s" class instead.', self::class, ErrorDetailsStamp::class));
62-
63-
return $this->exceptionMessage;
64-
}
65-
66-
/**
67-
* @deprecated since Symfony 5.2, use ErrorDetailsStamp instead.
68-
*/
69-
public function getFlattenException(): ?FlattenException
70-
{
71-
trigger_deprecation('symfony/messenger', '5.2', sprintf('Using the "getFlattenException()" method of the "%s" class is deprecated, use the "%s" class instead.', self::class, ErrorDetailsStamp::class));
72-
73-
return $this->flattenException;
74-
}
75-
7643
public function getRedeliveredAt(): \DateTimeInterface
7744
{
7845
return $this->redeliveredAt;

0 commit comments

Comments
 (0)
0