public function removeListener(string $event, callable $listener) : void
    {
        if (isset($this->listeners[$event])) {
            foreach ($this->listeners[$event] as $priority => $listeners) {
                foreach ($this->listeners[$event][$priority] as $key => $instance) {
                    if ($instance === $listener) {
                        unset($this->listeners[$event][$priority][$key]);
                        unset($this->sorted[$event]);

                        if (empty($this->listeners[$event][$priority])) {
                            unset($this->listeners[$event][$priority]);

                            if (empty($this->listeners[$event])) {
                                unset($this->listeners[$event]);
                            }
                        }
                    }
                }
            }
        }
    }