From 973fbcf17b96cb6427b721073ce685c1608afaf9 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Tue, 21 Aug 2018 23:42:00 +0200 Subject: [PATCH] Instantiate DispatchRoute manually Since we are already providing the first and only argument manually, we might as well instantiate the object manually. Same effect, same coupling, less code. --- src/Admin/AdminServiceProvider.php | 2 +- src/Api/ApiServiceProvider.php | 2 +- src/Forum/ForumServiceProvider.php | 2 +- src/Foundation/InstalledApp.php | 5 +---- src/Install/Installer.php | 5 +---- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Admin/AdminServiceProvider.php b/src/Admin/AdminServiceProvider.php index 6ec339bd2..859b0db0c 100644 --- a/src/Admin/AdminServiceProvider.php +++ b/src/Admin/AdminServiceProvider.php @@ -62,7 +62,7 @@ class AdminServiceProvider extends AbstractServiceProvider event(new ConfigureMiddleware($pipe, 'admin')); - $pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.admin.routes')])); + $pipe->pipe(new DispatchRoute($app->make('flarum.admin.routes'))); return $pipe; }); diff --git a/src/Api/ApiServiceProvider.php b/src/Api/ApiServiceProvider.php index b5b83d24e..f9370176b 100644 --- a/src/Api/ApiServiceProvider.php +++ b/src/Api/ApiServiceProvider.php @@ -66,7 +66,7 @@ class ApiServiceProvider extends AbstractServiceProvider event(new ConfigureMiddleware($pipe, 'api')); - $pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.api.routes')])); + $pipe->pipe(new DispatchRoute($app->make('flarum.api.routes'))); return $pipe; }); diff --git a/src/Forum/ForumServiceProvider.php b/src/Forum/ForumServiceProvider.php index 62655ef2a..c08d1deab 100644 --- a/src/Forum/ForumServiceProvider.php +++ b/src/Forum/ForumServiceProvider.php @@ -66,7 +66,7 @@ class ForumServiceProvider extends AbstractServiceProvider event(new ConfigureMiddleware($pipe, 'forum')); - $pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.forum.routes')])); + $pipe->pipe(new DispatchRoute($app->make('flarum.forum.routes'))); return $pipe; }); diff --git a/src/Foundation/InstalledApp.php b/src/Foundation/InstalledApp.php index 1b0c574bb..aefae6f02 100644 --- a/src/Foundation/InstalledApp.php +++ b/src/Foundation/InstalledApp.php @@ -99,10 +99,7 @@ class InstalledApp implements AppInterface { $pipe = new MiddlewarePipe; $pipe->pipe( - $this->laravel->make( - DispatchRoute::class, - ['routes' => $this->laravel->make('flarum.update.routes')] - ) + new DispatchRoute($this->laravel->make('flarum.update.routes')) ); return $pipe; diff --git a/src/Install/Installer.php b/src/Install/Installer.php index da9889db4..16ea3b9b5 100644 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -40,10 +40,7 @@ class Installer implements AppInterface $pipe->pipe($this->laravel->make(HandleErrorsWithWhoops::class)); $pipe->pipe($this->laravel->make(StartSession::class)); $pipe->pipe( - $this->laravel->make( - DispatchRoute::class, - ['routes' => $this->laravel->make('flarum.install.routes')] - ) + new DispatchRoute($this->laravel->make('flarum.install.routes')) ); return $pipe;