feature #33113 [Messenger][DX] Display real handler if handler is wrapped (DavidBadura)

This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger][DX] Display real handler if handler is wrapped

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

Execute:

```
bin/console debug:messenger
```

Before:

<img width="718" alt="Bildschirmfoto 2019-08-11 um 15 35 10" src="https://user-images.githubusercontent.com/470138/62834539-5faaa280-bc4e-11e9-99d6-a7e98822108c.png">

After:

<img width="673" alt="Bildschirmfoto 2019-08-11 um 15 34 27" src="https://user-images.githubusercontent.com/470138/62834540-646f5680-bc4e-11e9-9aa7-c5fb5219204c.png">

Commits
-------

e6ce9b560c display real handler if handler is wrapped
This commit is contained in:
Fabien Potencier 2019-09-25 21:12:09 +02:00
commit b0c2112fb7

View File

@ -70,6 +70,7 @@ class MessengerPass implements CompilerPassInterface
{
$definitions = [];
$handlersByBusAndMessage = [];
$handlerToOriginalServiceIdMapping = [];
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
foreach ($tags as $tag) {
@ -144,6 +145,8 @@ class MessengerPass implements CompilerPassInterface
$definitionId = $serviceId;
}
$handlerToOriginalServiceIdMapping[$definitionId] = $serviceId;
foreach ($buses as $handlerBus) {
$handlersByBusAndMessage[$handlerBus][$message][$priority][] = [$definitionId, $options];
}
@ -193,6 +196,12 @@ class MessengerPass implements CompilerPassInterface
if (!isset($debugCommandMapping[$bus])) {
$debugCommandMapping[$bus] = [];
}
foreach ($debugCommandMapping[$bus] as $message => $handlers) {
foreach ($handlers as $key => $handler) {
$debugCommandMapping[$bus][$message][$key][0] = $handlerToOriginalServiceIdMapping[$handler[0]];
}
}
}
$container->getDefinition('console.command.messenger_debug')->replaceArgument(0, $debugCommandMapping);
}