protected function sortListeners(string $event) : interfaces\Emitter
    {
        if (!isset($this->listeners[$event])) {
            return $this;
        }

        // Sort the listeners by priority in a descending order.
        krsort($this->listeners[$event]);

        $this->chain[$event] = array_merge(...$this->listeners[$event]);

        return $this;
    }