1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

fix(phpstan): code analysis

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
Sami Mazouz
2023-07-27 13:52:58 +01:00
parent 7467beb72f
commit 608e2a7e5a
3 changed files with 10 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\SiteInterface; use Flarum\Foundation\SiteInterface;
use Illuminate\Console\Events\CommandFinished; use Illuminate\Console\Events\CommandFinished;
use Illuminate\Console\Events\CommandStarting; use Illuminate\Console\Events\CommandStarting;
use Illuminate\Container\Container; use Illuminate\Contracts\Container\Container;
use Illuminate\Events\Dispatcher; use Illuminate\Events\Dispatcher;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\ConsoleEvents;
@@ -65,9 +65,7 @@ class Server
); );
}); });
$dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) { $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) use ($container) {
$container = Container::getInstance();
/** @var Registry $registry */ /** @var Registry $registry */
$registry = $container->make(Registry::class); $registry = $container->make(Registry::class);
$error = $registry->handle($event->getError()); $error = $registry->handle($event->getError());

View File

@@ -9,11 +9,14 @@
namespace Flarum\Foundation; namespace Flarum\Foundation;
use Illuminate\Contracts\Container\Container;
use Psr\Http\Server\RequestHandlerInterface; use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
interface AppInterface interface AppInterface
{ {
public function getContainer(): Container;
public function getRequestHandler(): RequestHandlerInterface; public function getRequestHandler(): RequestHandlerInterface;
/** /**

View File

@@ -26,6 +26,11 @@ class Installer implements AppInterface
) { ) {
} }
public function getContainer(): Container
{
return $this->container;
}
public function getRequestHandler(): RequestHandlerInterface public function getRequestHandler(): RequestHandlerInterface
{ {
$pipe = new MiddlewarePipe; $pipe = new MiddlewarePipe;