@@ -48,14 +48,16 @@ public function process(ContainerBuilder $container)
48
48
foreach ($ handlers as $ id => $ args ) {
49
49
// Safeguard to have only one tag per command / query
50
50
if ($ type !== 'event ' && count ($ args ) > 1 ) {
51
- throw CompilerPassException::tagCountExceeded ($ id , $ id , $ bus );
51
+ throw CompilerPassException::tagCountExceeded ($ type , $ id , $ bus );
52
52
}
53
53
foreach ($ args as $ eachArgs ) {
54
54
if ((! isset ($ eachArgs ['message_detection ' ]) || $ eachArgs ['message_detection ' ] !== true ) && ! isset ($ eachArgs ['message ' ])) {
55
55
throw CompilerPassException::messageTagMissing ($ id );
56
56
}
57
57
58
- $ messageNames = isset ($ eachArgs ['message ' ]) ? [$ eachArgs ['message ' ]] : $ this ->recognizeMessageNames ($ container , $ container ->getDefinition ($ id ));
58
+ $ messageNames = isset ($ eachArgs ['message ' ])
59
+ ? [$ eachArgs ['message ' ]]
60
+ : $ this ->recognizeMessageNames ($ container , $ container ->getDefinition ($ id ), $ id , $ type );
59
61
60
62
if ($ type === 'event ' ) {
61
63
$ routerArguments [0 ] = array_merge_recursive (
@@ -84,9 +86,16 @@ public function process(ContainerBuilder $container)
84
86
}
85
87
}
86
88
87
- private function recognizeMessageNames (ContainerBuilder $ container , Definition $ routeDefinition ): array
88
- {
89
+ private function recognizeMessageNames (
90
+ ContainerBuilder $ container ,
91
+ Definition $ routeDefinition ,
92
+ string $ routeId ,
93
+ string $ busType
94
+ ): array {
89
95
$ handlerReflection = $ container ->getReflectionClass ($ routeDefinition ->getClass ());
96
+ if (! $ handlerReflection ) {
97
+ throw CompilerPassException::unknownHandlerClass ($ routeDefinition ->getClass (), $ routeId , $ busType );
98
+ }
90
99
91
100
$ methodsWithMessageParameter = array_filter (
92
101
$ handlerReflection ->getMethods (ReflectionMethod::IS_PUBLIC ),
0 commit comments