/**
  * {@inheritdoc}
  */
 public function hasHandlers(string $eventType = null) : bool
 {
     if ($eventType === null) {
         return (bool) count($this->serviceIds) || (bool) count($this->handlers);
     }
     if (isset($this->serviceIds[$eventType])) {
         return true;
     }
     return parent::hasHandlers($eventType);
 }
 public function test_that_remove_handler_does_not_error_when_handler_not_registered()
 {
     $this->dispatcher->removeHandler('foo', function () {
     });
     $this->assertFalse($this->dispatcher->hasHandlers());
 }