diff --git a/framework/core/src/Console/Server.php b/framework/core/src/Console/Server.php index a9afed30d..fa61d3a92 100644 --- a/framework/core/src/Console/Server.php +++ b/framework/core/src/Console/Server.php @@ -14,7 +14,7 @@ use Flarum\Foundation\ErrorHandling\Reporter; use Flarum\Foundation\SiteInterface; use Illuminate\Console\Events\CommandFinished; use Illuminate\Console\Events\CommandStarting; -use Illuminate\Container\Container; +use Illuminate\Contracts\Container\Container; use Illuminate\Events\Dispatcher; use Symfony\Component\Console\Application; use Symfony\Component\Console\ConsoleEvents; @@ -65,9 +65,7 @@ class Server ); }); - $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) { - $container = Container::getInstance(); - + $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) use ($container) { /** @var Registry $registry */ $registry = $container->make(Registry::class); $error = $registry->handle($event->getError()); diff --git a/framework/core/src/Foundation/AppInterface.php b/framework/core/src/Foundation/AppInterface.php index 4ffb48317..7bf115e9c 100644 --- a/framework/core/src/Foundation/AppInterface.php +++ b/framework/core/src/Foundation/AppInterface.php @@ -9,11 +9,14 @@ namespace Flarum\Foundation; +use Illuminate\Contracts\Container\Container; use Psr\Http\Server\RequestHandlerInterface; use Symfony\Component\Console\Command\Command; interface AppInterface { + public function getContainer(): Container; + public function getRequestHandler(): RequestHandlerInterface; /** diff --git a/framework/core/src/Install/Installer.php b/framework/core/src/Install/Installer.php index 06da93f67..192e499cd 100644 --- a/framework/core/src/Install/Installer.php +++ b/framework/core/src/Install/Installer.php @@ -26,6 +26,11 @@ class Installer implements AppInterface ) { } + public function getContainer(): Container + { + return $this->container; + } + public function getRequestHandler(): RequestHandlerInterface { $pipe = new MiddlewarePipe;