You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #31252 Fix left-associative ternary deprecation warnings for PHP 7.4 (thib92)
This PR was submitted for the master branch but it was merged into the 4.2 branch instead (closes#31252).
Discussion
----------
Fix left-associative ternary deprecation warnings for PHP 7.4
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31246
| License | MIT
| Doc PR | none
All the context is explained in issue #31246. Only two files (three occurrences in total) used a chained ternary operator in the Symfony codebase, which will be deprecated in PHP 7.4 (removed in PHP 8), following [this RFC](https://wiki.php.net/rfc/ternary_associativity).
Commits
-------
3022a36 Fix left-associative ternary deprecation warnings for PHP 7.4
Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
110
110
if (\is_array($method)) {
111
111
if (isset($method['bus'])) {
112
112
if (!\in_array($method['bus'], $busIds)) {
113
-
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
113
+
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : ($r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method));
114
114
115
115
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s": bus "%s" does not exist.', $messageLocation, $message, $method['bus']));
116
116
}
@@ -123,7 +123,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
123
123
}
124
124
125
125
if ('*' !== $message && !class_exists($message) && !interface_exists($message, false)) {
126
-
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : $r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method);
126
+
$messageLocation = isset($tag['handles']) ? 'declared in your tag attribute "handles"' : ($r->implementsInterface(MessageSubscriberInterface::class) ? sprintf('returned by method "%s::getHandledMessages()"', $r->getName()) : sprintf('used as argument type in method "%s::%s()"', $r->getName(), $method));
127
127
128
128
thrownewRuntimeException(sprintf('Invalid handler service "%s": class or interface "%s" %s not found.', $serviceId, $message, $messageLocation));
0 commit comments