1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 07:54:25 +02:00

Split up Application and Container

- Stop trying to implement Laravel's Application contract, which
  has no value for us.
- Stop inheriting from the Container, injecting one works equally
  well and does not clutter up the interfaces.
- Inject the Paths collection instead of unwrapping it again, for
  better encapsulation.

This brings us one step closer toward upgrading our Laravel
components (#2055), because we no longer need to adopt the changes
to the Application contract.
This commit is contained in:
Franz Liedke
2020-05-01 09:53:55 +00:00
parent d0ae2839f0
commit 41a56c4ad1
16 changed files with 110 additions and 453 deletions

View File

@@ -13,7 +13,6 @@ use Flarum\Extension\Event\Disabled;
use Flarum\Extension\Event\Enabled;
use Flarum\Formatter\Formatter;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\ErrorHandling\ViewFormatter;
@@ -70,14 +69,14 @@ class ForumServiceProvider extends AbstractServiceProvider
];
});
$this->app->singleton('flarum.forum.handler', function (Application $app) {
$this->app->singleton('flarum.forum.handler', function () {
$pipe = new MiddlewarePipe;
// All requests should first be piped through our global error handler
$pipe->pipe(new HttpMiddleware\HandleErrors(
$app->make(Registry::class),
$app->inDebugMode() ? $app->make(WhoopsFormatter::class) : $app->make(ViewFormatter::class),
$app->tagged(Reporter::class)
$this->app->make(Registry::class),
$this->app['flarum']->inDebugMode() ? $this->app->make(WhoopsFormatter::class) : $this->app->make(ViewFormatter::class),
$this->app->tagged(Reporter::class)
));
foreach ($this->app->make('flarum.forum.middleware') as $middleware) {