Skip to content

Commit 33d437b

Browse files
Leverage trigger_deprecation() from symfony/deprecation-contracts
1 parent db6a2c2 commit 33d437b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Tests/Transport/ConnectionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function testOptionsAreTakenIntoAccountAndOverwrittenByDsn()
104104

105105
/**
106106
* @group legacy
107-
* @expectedDeprecation Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.
107+
* @expectedDeprecation Since symfony/messenger 5.1: Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated.
108108
*/
109109
public function testDeprecationIfInvalidOptionIsPassedWithDsn()
110110
{
@@ -113,7 +113,7 @@ public function testDeprecationIfInvalidOptionIsPassedWithDsn()
113113

114114
/**
115115
* @group legacy
116-
* @expectedDeprecation Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.
116+
* @expectedDeprecation Since symfony/messenger 5.1: Invalid option(s) "foo" passed to the AMQP Messenger transport. Passing invalid options is deprecated.
117117
*/
118118
public function testDeprecationIfInvalidOptionIsPassedAsArgument()
119119
{
@@ -122,7 +122,7 @@ public function testDeprecationIfInvalidOptionIsPassedAsArgument()
122122

123123
/**
124124
* @group legacy
125-
* @expectedDeprecation Invalid queue option(s) "foo" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated since Symfony 5.1.
125+
* @expectedDeprecation Since symfony/messenger 5.1: Invalid queue option(s) "foo" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated.
126126
*/
127127
public function testDeprecationIfInvalidQueueOptionIsPassed()
128128
{
@@ -131,7 +131,7 @@ public function testDeprecationIfInvalidQueueOptionIsPassed()
131131

132132
/**
133133
* @group legacy
134-
* @expectedDeprecation Invalid exchange option(s) "foo" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated since Symfony 5.1.
134+
* @expectedDeprecation Since symfony/messenger 5.1: Invalid exchange option(s) "foo" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated.
135135
*/
136136
public function testDeprecationIfInvalidExchangeOptionIsPassed()
137137
{

Transport/Connection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am
220220
private static function validateOptions(array $options): void
221221
{
222222
if (0 < \count($invalidOptions = array_diff(array_keys($options), self::AVAILABLE_OPTIONS))) {
223-
@trigger_error(sprintf('Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated since Symfony 5.1.', implode('", "', $invalidOptions)), E_USER_DEPRECATED);
223+
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
224224
}
225225

226226
if (\is_array($options['queues'] ?? false)) {
@@ -230,14 +230,14 @@ private static function validateOptions(array $options): void
230230
}
231231

232232
if (0 < \count($invalidQueueOptions = array_diff(array_keys($queue), self::AVAILABLE_QUEUE_OPTIONS))) {
233-
@trigger_error(sprintf('Invalid queue option(s) "%s" passed to the AMQP Messenger transport. Passing invalid queue options is deprecated since Symfony 5.1.', implode('", "', $invalidQueueOptions)), E_USER_DEPRECATED);
233+
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));
234234
}
235235
}
236236
}
237237

238238
if (\is_array($options['exchange'] ?? false)
239239
&& 0 < \count($invalidExchangeOptions = array_diff(array_keys($options['exchange']), self::AVAILABLE_EXCHANGE_OPTIONS))) {
240-
@trigger_error(sprintf('Invalid exchange option(s) "%s" passed to the AMQP Messenger transport. Passing invalid exchange options is deprecated since Symfony 5.1.', implode('", "', $invalidExchangeOptions)), E_USER_DEPRECATED);
240+
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));
241241
}
242242
}
243243

0 commit comments

Comments
 (0)