/**
* Registers a handler to a particular event group.
*
* @param string $event The event name.
* @param callable $handler The handler, a function or an instance of an event object.
*
* @return $this
*
* @since 4.0.0
*/
public function registerEvent($event, callable $handler)
{
try {
$this->getDispatcher()->addListener($event, $handler);
} catch (\UnexpectedValueException $e) {
// No dispatcher is registered, don't throw an error (mimics old behavior)
}
return $this;
}