src/Router.php
protected function sortModules()
    {
        parent::sortModules();

        if ($this->root !== null && $this->root_search_path !== $this->search_path)
        {
            $this->root = null;
            $this->root_search_path = null;
        }
    }
protected function sortModules()
    {
        parent::sortModules();

        if ($this->root !== null && $this->root_search_path !== $this->search_path)
        {
            $this->root = null;
            $this->root_search_path = null;
        }
    }
Sort the modules, check if anything has changed