The doc comment array<class-string, callable> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string, callable>.
Loading history...
21
* Where _key_ is a message class and _value_ a handler for that message class.
22
*/
23
public function __construct(
24
private array $handlers
25
) {
26
}
27
28
public function getHandlerForMessage(object $message): callable
29
{
30
$class = $message::class;
31
32
return $this->handlers[$class]
33
?? throw new HandlerNotFound("No handler for messages of type `$class`.");