1
0
mirror of https://github.com/flarum/core.git synced 2025-07-29 20:50:28 +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

@@ -15,7 +15,6 @@ use Flarum\Api\Serializer\BasicDiscussionSerializer;
use Flarum\Api\Serializer\NotificationSerializer;
use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use Flarum\Foundation\ErrorHandling\JsonApiFormatter;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
@@ -56,13 +55,13 @@ class ApiServiceProvider extends AbstractServiceProvider
];
});
$this->app->singleton('flarum.api.handler', function (Application $app) {
$this->app->singleton('flarum.api.handler', function () {
$pipe = new MiddlewarePipe;
$pipe->pipe(new HttpMiddleware\HandleErrors(
$app->make(Registry::class),
new JsonApiFormatter($app->inDebugMode()),
$app->tagged(Reporter::class)
$this->app->make(Registry::class),
new JsonApiFormatter($this->app['flarum']->inDebugMode()),
$this->app->tagged(Reporter::class)
));
foreach ($this->app->make('flarum.api.middleware') as $middleware) {