From 4413848c11e44996497cd786011edebbd785c3d1 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 6 Mar 2020 13:55:39 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/Bus/BusServiceProvider.php | 6 +++-- src/Discussion/DiscussionServiceProvider.php | 3 ++- .../Search/Gambit/FulltextGambit.php | 4 +++- src/Extend/Frontend.php | 3 ++- src/Extend/Middleware.php | 9 ++++--- .../IlluminateValidationExceptionHandler.php | 4 +++- .../ValidationExceptionHandler.php | 4 +++- src/Foundation/UninstalledSite.php | 4 +++- .../Middleware/ShareErrorsFromSession.php | 3 ++- src/Install/Installation.php | 5 +++- src/Install/Steps/RunMigrations.php | 3 ++- src/Mail/MailServiceProvider.php | 4 +++- src/User/Search/Gambit/FulltextGambit.php | 6 +++-- .../api/authentication/WithTokenTest.php | 6 +++-- .../csrf_protection/RequireCsrfTokenTest.php | 24 ++++++++++++------- tests/integration/api/users/CreationTest.php | 12 ++++++---- 16 files changed, 69 insertions(+), 31 deletions(-) diff --git a/src/Bus/BusServiceProvider.php b/src/Bus/BusServiceProvider.php index 3381a0e85..57377ef7c 100644 --- a/src/Bus/BusServiceProvider.php +++ b/src/Bus/BusServiceProvider.php @@ -26,11 +26,13 @@ class BusServiceProvider extends AbstractServiceProvider }); $this->app->alias( - BaseDispatcher::class, DispatcherContract::class + BaseDispatcher::class, + DispatcherContract::class ); $this->app->alias( - BaseDispatcher::class, QueueingDispatcherContract::class + BaseDispatcher::class, + QueueingDispatcherContract::class ); } } diff --git a/src/Discussion/DiscussionServiceProvider.php b/src/Discussion/DiscussionServiceProvider.php index 7a8d922fc..3f0ba9997 100644 --- a/src/Discussion/DiscussionServiceProvider.php +++ b/src/Discussion/DiscussionServiceProvider.php @@ -25,7 +25,8 @@ class DiscussionServiceProvider extends AbstractServiceProvider $events->subscribe(DiscussionPolicy::class); $events->listen( - Renamed::class, DiscussionRenamedLogger::class + Renamed::class, + DiscussionRenamedLogger::class ); } } diff --git a/src/Discussion/Search/Gambit/FulltextGambit.php b/src/Discussion/Search/Gambit/FulltextGambit.php index d9cad23d1..ea3fe3ede 100644 --- a/src/Discussion/Search/Gambit/FulltextGambit.php +++ b/src/Discussion/Search/Gambit/FulltextGambit.php @@ -53,7 +53,9 @@ class FulltextGambit implements GambitInterface ->addSelect('posts_ft.most_relevant_post_id') ->join( new Expression('('.$subquery->toSql().') '.$grammar->wrapTable('posts_ft')), - 'posts_ft.discussion_id', '=', 'discussions.id' + 'posts_ft.discussion_id', + '=', + 'discussions.id' ) ->addBinding($subquery->getBindings(), 'join') ->where(function ($query) use ($grammar, $bit) { diff --git a/src/Extend/Frontend.php b/src/Extend/Frontend.php index e00154381..9f7129101 100644 --- a/src/Extend/Frontend.php +++ b/src/Extend/Frontend.php @@ -152,7 +152,8 @@ class Frontend implements ExtenderInterface foreach ($this->routes as $route) { $collection->get( - $route['path'], $route['name'], + $route['path'], + $route['name'], $factory->toFrontend($this->frontend, $route['content']) ); } diff --git a/src/Extend/Middleware.php b/src/Extend/Middleware.php index b6058ecf0..73e0d2d5e 100644 --- a/src/Extend/Middleware.php +++ b/src/Extend/Middleware.php @@ -69,7 +69,8 @@ class Middleware implements ExtenderInterface } foreach ($this->replaceMiddlewares as $originalMiddleware => $newMiddleware) { - $existingMiddleware = array_replace($existingMiddleware, + $existingMiddleware = array_replace( + $existingMiddleware, array_fill_keys( array_keys($existingMiddleware, $originalMiddleware), $newMiddleware @@ -78,7 +79,8 @@ class Middleware implements ExtenderInterface } foreach ($this->insertBeforeMiddlewares as $originalMiddleware => $newMiddleware) { - array_splice($existingMiddleware, + array_splice( + $existingMiddleware, array_search($originalMiddleware, $existingMiddleware), 0, $newMiddleware @@ -86,7 +88,8 @@ class Middleware implements ExtenderInterface } foreach ($this->insertAfterMiddlewares as $originalMiddleware => $newMiddleware) { - array_splice($existingMiddleware, + array_splice( + $existingMiddleware, array_search($originalMiddleware, $existingMiddleware) + 1, 0, $newMiddleware diff --git a/src/Foundation/ErrorHandling/ExceptionHandler/IlluminateValidationExceptionHandler.php b/src/Foundation/ErrorHandling/ExceptionHandler/IlluminateValidationExceptionHandler.php index 304402ec3..a6c1c7fbf 100644 --- a/src/Foundation/ErrorHandling/ExceptionHandler/IlluminateValidationExceptionHandler.php +++ b/src/Foundation/ErrorHandling/ExceptionHandler/IlluminateValidationExceptionHandler.php @@ -17,7 +17,9 @@ class IlluminateValidationExceptionHandler public function handle(ValidationException $e): HandledError { return (new HandledError( - $e, 'validation_error', 422 + $e, + 'validation_error', + 422 ))->withDetails($this->errorDetails($e)); } diff --git a/src/Foundation/ErrorHandling/ExceptionHandler/ValidationExceptionHandler.php b/src/Foundation/ErrorHandling/ExceptionHandler/ValidationExceptionHandler.php index 5baeec692..ceec9bd31 100644 --- a/src/Foundation/ErrorHandling/ExceptionHandler/ValidationExceptionHandler.php +++ b/src/Foundation/ErrorHandling/ExceptionHandler/ValidationExceptionHandler.php @@ -17,7 +17,9 @@ class ValidationExceptionHandler public function handle(ValidationException $e) { return (new HandledError( - $e, 'validation_error', 422 + $e, + 'validation_error', + 422 ))->withDetails(array_merge( $this->buildDetails($e->getAttributes(), '/data/attributes'), $this->buildDetails($e->getRelationships(), '/data/relationships') diff --git a/src/Foundation/UninstalledSite.php b/src/Foundation/UninstalledSite.php index 1012a0a7d..64c1b329c 100644 --- a/src/Foundation/UninstalledSite.php +++ b/src/Foundation/UninstalledSite.php @@ -89,7 +89,9 @@ class UninstalledSite implements SiteInterface $dispatcher = $app->make(Dispatcher::class); return new \Illuminate\View\Factory( - $engines, $finder, $dispatcher + $engines, + $finder, + $dispatcher ); }); diff --git a/src/Http/Middleware/ShareErrorsFromSession.php b/src/Http/Middleware/ShareErrorsFromSession.php index 06eaf9bfe..17e8f7e78 100644 --- a/src/Http/Middleware/ShareErrorsFromSession.php +++ b/src/Http/Middleware/ShareErrorsFromSession.php @@ -44,7 +44,8 @@ class ShareErrorsFromSession implements Middleware // its value with all view instances so the views can easily access errors // without having to bind. An empty bag is set when there aren't errors. $this->view->share( - 'errors', $session->get('errors', new ViewErrorBag) + 'errors', + $session->get('errors', new ViewErrorBag) ); // Putting the errors in the view for every view allows the developer to just diff --git a/src/Install/Installation.php b/src/Install/Installation.php index 3b14a3baa..ed3f6f263 100644 --- a/src/Install/Installation.php +++ b/src/Install/Installation.php @@ -120,7 +120,10 @@ class Installation $pipeline->pipe(function () { return new Steps\StoreConfig( - $this->debug, $this->dbConfig, $this->baseUrl, $this->getConfigPath() + $this->debug, + $this->dbConfig, + $this->baseUrl, + $this->getConfigPath() ); }); diff --git a/src/Install/Steps/RunMigrations.php b/src/Install/Steps/RunMigrations.php index 285da6cf5..5539e7f8a 100644 --- a/src/Install/Steps/RunMigrations.php +++ b/src/Install/Steps/RunMigrations.php @@ -49,7 +49,8 @@ class RunMigrations implements Step private function getMigrator() { $repository = new DatabaseMigrationRepository( - $this->database, 'migrations' + $this->database, + 'migrations' ); $files = new Filesystem; diff --git a/src/Mail/MailServiceProvider.php b/src/Mail/MailServiceProvider.php index 9b99d7ac0..9b1bfcaeb 100644 --- a/src/Mail/MailServiceProvider.php +++ b/src/Mail/MailServiceProvider.php @@ -64,7 +64,9 @@ class MailServiceProvider extends AbstractServiceProvider $this->app->singleton('mailer', function ($app) { $mailer = new Mailer( - $app['view'], $app['swift.mailer'], $app['events'] + $app['view'], + $app['swift.mailer'], + $app['events'] ); if ($app->bound('queue')) { diff --git a/src/User/Search/Gambit/FulltextGambit.php b/src/User/Search/Gambit/FulltextGambit.php index 9cfe5ea20..410d74810 100644 --- a/src/User/Search/Gambit/FulltextGambit.php +++ b/src/User/Search/Gambit/FulltextGambit.php @@ -46,7 +46,9 @@ class FulltextGambit implements GambitInterface public function apply(AbstractSearch $search, $searchValue) { $search->getQuery() - ->whereIn('id', - $this->getUserSearchSubQuery($searchValue)); + ->whereIn( + 'id', + $this->getUserSearchSubQuery($searchValue) + ); } } diff --git a/tests/integration/api/authentication/WithTokenTest.php b/tests/integration/api/authentication/WithTokenTest.php index 4d590c7d4..85775bb84 100644 --- a/tests/integration/api/authentication/WithTokenTest.php +++ b/tests/integration/api/authentication/WithTokenTest.php @@ -35,7 +35,8 @@ class WithTokenTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/token', + 'POST', + '/api/token', [ 'json' => [ 'identification' => 'normal', @@ -66,7 +67,8 @@ class WithTokenTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/token', + 'POST', + '/api/token', [ 'json' => [ 'identification' => 'normal', diff --git a/tests/integration/api/csrf_protection/RequireCsrfTokenTest.php b/tests/integration/api/csrf_protection/RequireCsrfTokenTest.php index 690544b9a..697eb3443 100644 --- a/tests/integration/api/csrf_protection/RequireCsrfTokenTest.php +++ b/tests/integration/api/csrf_protection/RequireCsrfTokenTest.php @@ -49,7 +49,8 @@ class RequireCsrfTokenTest extends TestCase { $auth = $this->send( $this->request( - 'POST', '/login', + 'POST', + '/login', [ 'json' => ['identification' => 'admin', 'password' => 'password'], ] @@ -58,7 +59,8 @@ class RequireCsrfTokenTest extends TestCase $response = $this->send( $this->request( - 'POST', '/api/settings', + 'POST', + '/api/settings', [ 'cookiesFrom' => $auth, 'json' => ['csrf_test' => 2], @@ -92,7 +94,8 @@ class RequireCsrfTokenTest extends TestCase $auth = $this->send( $this->request( - 'POST', '/login', + 'POST', + '/login', [ 'cookiesFrom' => $initial, 'json' => ['identification' => 'admin', 'password' => 'password'], @@ -104,7 +107,8 @@ class RequireCsrfTokenTest extends TestCase $response = $this->send( $this->request( - 'POST', '/api/settings', + 'POST', + '/api/settings', [ 'cookiesFrom' => $auth, 'json' => ['csrf_test' => 2], @@ -135,7 +139,8 @@ class RequireCsrfTokenTest extends TestCase $auth = $this->send( $this->request( - 'POST', '/login', + 'POST', + '/login', [ 'cookiesFrom' => $initial, 'json' => ['identification' => 'admin', 'password' => 'password', 'csrfToken' => $token], @@ -147,7 +152,8 @@ class RequireCsrfTokenTest extends TestCase $response = $this->send( $this->request( - 'POST', '/api/settings', + 'POST', + '/api/settings', [ 'cookiesFrom' => $auth, 'json' => ['csrf_test' => 2, 'csrfToken' => $token], @@ -172,7 +178,8 @@ class RequireCsrfTokenTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/settings', + 'POST', + '/api/settings', [ 'json' => ['csrf_test' => 2], ] @@ -200,7 +207,8 @@ class RequireCsrfTokenTest extends TestCase $response = $this->send( $this->request( - 'POST', '/api/settings', + 'POST', + '/api/settings', [ 'json' => ['csrf_test' => 2], ] diff --git a/tests/integration/api/users/CreationTest.php b/tests/integration/api/users/CreationTest.php index e77a44ccc..25c763577 100644 --- a/tests/integration/api/users/CreationTest.php +++ b/tests/integration/api/users/CreationTest.php @@ -48,7 +48,8 @@ class CreationTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/users', + 'POST', + '/api/users', [ 'json' => ['data' => ['attributes' => []]], ] @@ -91,7 +92,8 @@ class CreationTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/users', + 'POST', + '/api/users', [ 'json' => [ 'data' => [ @@ -123,7 +125,8 @@ class CreationTest extends TestCase { $response = $this->send( $this->request( - 'POST', '/api/users', + 'POST', + '/api/users', [ 'json' => [ 'data' => [ @@ -158,7 +161,8 @@ class CreationTest extends TestCase $response = $this->send( $this->request( - 'POST', '/api/users', + 'POST', + '/api/users', [ 'json' => [ 'data' => [