public function stopApplication() : void
    {
        if ($this->hasApplicationBeenStarted()) {
            foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
                call_user_func($callback);
            }

            $this->app->flush();
            $this->app = null;

            Facade::clearResolvedInstances();
            Facade::setFacadeApplication(null);
        }
    }