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
feature #28294 [Messenger] Remove the "obscure" message subscriber configuration (sroze)
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] Remove the "obscure" message subscriber configuration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ø
| License | MIT
| Doc PR | ø
As described in #28275, all of the configuration can be done using yield and that we could remove the support for other ways (especially the obscure return `[['method', -10]]` syntax) as I believe this would clarify the configuration a lot.
Commits
-------
cf2ad861f5 Remove the "obscure" message subscriber configuration
$messageClassLocation = 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);
121
-
122
-
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s": bus "%s" does not exist.', $messageClassLocation, $messageClass, $method['bus']));
123
-
}
124
-
125
-
$buses = array($method['bus']);
126
-
}
114
+
if (isset($method['bus'])) {
115
+
if (!\in_array($method['bus'], $busIds)) {
116
+
$messageClassLocation = 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
117
128
-
if (isset($method['priority'])) {
129
-
$messagePriority = $method['priority'];
118
+
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s": bus "%s" does not exist.', $messageClassLocation, $messageClass, $method['bus']));
130
119
}
131
120
132
-
$method = $method['method'] ?? '__invoke';
133
-
} else {
134
-
$messageClassLocation = 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);
121
+
$buses = array($method['bus']);
122
+
}
135
123
136
-
thrownewRuntimeException(sprintf('Invalid configuration %s for message "%s".', $messageClassLocation, $messageClass));
124
+
if (isset($method['priority'])) {
125
+
$messagePriority = $method['priority'];
137
126
}
127
+
128
+
$method = $method['method'] ?? '__invoke';
138
129
}
139
130
140
131
if (!\class_exists($messageClass) && !\interface_exists($messageClass)) {
0 commit comments