1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 15:51:16 +02:00

Apply fixes from StyleCI

[ci skip] [skip ci]
This commit is contained in:
Franz Liedke
2020-03-06 13:55:39 +00:00
committed by StyleCI Bot
parent 390b529da7
commit a1a2b35221
16 changed files with 69 additions and 31 deletions

View File

@@ -26,11 +26,13 @@ class BusServiceProvider extends AbstractServiceProvider
}); });
$this->app->alias( $this->app->alias(
BaseDispatcher::class, DispatcherContract::class BaseDispatcher::class,
DispatcherContract::class
); );
$this->app->alias( $this->app->alias(
BaseDispatcher::class, QueueingDispatcherContract::class BaseDispatcher::class,
QueueingDispatcherContract::class
); );
} }
} }

View File

@@ -25,7 +25,8 @@ class DiscussionServiceProvider extends AbstractServiceProvider
$events->subscribe(DiscussionPolicy::class); $events->subscribe(DiscussionPolicy::class);
$events->listen( $events->listen(
Renamed::class, DiscussionRenamedLogger::class Renamed::class,
DiscussionRenamedLogger::class
); );
} }
} }

View File

@@ -53,7 +53,9 @@ class FulltextGambit implements GambitInterface
->addSelect('posts_ft.most_relevant_post_id') ->addSelect('posts_ft.most_relevant_post_id')
->join( ->join(
new Expression('('.$subquery->toSql().') '.$grammar->wrapTable('posts_ft')), new Expression('('.$subquery->toSql().') '.$grammar->wrapTable('posts_ft')),
'posts_ft.discussion_id', '=', 'discussions.id' 'posts_ft.discussion_id',
'=',
'discussions.id'
) )
->addBinding($subquery->getBindings(), 'join') ->addBinding($subquery->getBindings(), 'join')
->where(function ($query) use ($grammar, $bit) { ->where(function ($query) use ($grammar, $bit) {

View File

@@ -152,7 +152,8 @@ class Frontend implements ExtenderInterface
foreach ($this->routes as $route) { foreach ($this->routes as $route) {
$collection->get( $collection->get(
$route['path'], $route['name'], $route['path'],
$route['name'],
$factory->toFrontend($this->frontend, $route['content']) $factory->toFrontend($this->frontend, $route['content'])
); );
} }

View File

@@ -69,7 +69,8 @@ class Middleware implements ExtenderInterface
} }
foreach ($this->replaceMiddlewares as $originalMiddleware => $newMiddleware) { foreach ($this->replaceMiddlewares as $originalMiddleware => $newMiddleware) {
$existingMiddleware = array_replace($existingMiddleware, $existingMiddleware = array_replace(
$existingMiddleware,
array_fill_keys( array_fill_keys(
array_keys($existingMiddleware, $originalMiddleware), array_keys($existingMiddleware, $originalMiddleware),
$newMiddleware $newMiddleware
@@ -78,7 +79,8 @@ class Middleware implements ExtenderInterface
} }
foreach ($this->insertBeforeMiddlewares as $originalMiddleware => $newMiddleware) { foreach ($this->insertBeforeMiddlewares as $originalMiddleware => $newMiddleware) {
array_splice($existingMiddleware, array_splice(
$existingMiddleware,
array_search($originalMiddleware, $existingMiddleware), array_search($originalMiddleware, $existingMiddleware),
0, 0,
$newMiddleware $newMiddleware
@@ -86,7 +88,8 @@ class Middleware implements ExtenderInterface
} }
foreach ($this->insertAfterMiddlewares as $originalMiddleware => $newMiddleware) { foreach ($this->insertAfterMiddlewares as $originalMiddleware => $newMiddleware) {
array_splice($existingMiddleware, array_splice(
$existingMiddleware,
array_search($originalMiddleware, $existingMiddleware) + 1, array_search($originalMiddleware, $existingMiddleware) + 1,
0, 0,
$newMiddleware $newMiddleware

View File

@@ -17,7 +17,9 @@ class IlluminateValidationExceptionHandler
public function handle(ValidationException $e): HandledError public function handle(ValidationException $e): HandledError
{ {
return (new HandledError( return (new HandledError(
$e, 'validation_error', 422 $e,
'validation_error',
422
))->withDetails($this->errorDetails($e)); ))->withDetails($this->errorDetails($e));
} }

View File

@@ -17,7 +17,9 @@ class ValidationExceptionHandler
public function handle(ValidationException $e) public function handle(ValidationException $e)
{ {
return (new HandledError( return (new HandledError(
$e, 'validation_error', 422 $e,
'validation_error',
422
))->withDetails(array_merge( ))->withDetails(array_merge(
$this->buildDetails($e->getAttributes(), '/data/attributes'), $this->buildDetails($e->getAttributes(), '/data/attributes'),
$this->buildDetails($e->getRelationships(), '/data/relationships') $this->buildDetails($e->getRelationships(), '/data/relationships')

View File

@@ -89,7 +89,9 @@ class UninstalledSite implements SiteInterface
$dispatcher = $app->make(Dispatcher::class); $dispatcher = $app->make(Dispatcher::class);
return new \Illuminate\View\Factory( return new \Illuminate\View\Factory(
$engines, $finder, $dispatcher $engines,
$finder,
$dispatcher
); );
}); });

View File

@@ -44,7 +44,8 @@ class ShareErrorsFromSession implements Middleware
// its value with all view instances so the views can easily access errors // 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. // without having to bind. An empty bag is set when there aren't errors.
$this->view->share( $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 // Putting the errors in the view for every view allows the developer to just

View File

@@ -120,7 +120,10 @@ class Installation
$pipeline->pipe(function () { $pipeline->pipe(function () {
return new Steps\StoreConfig( return new Steps\StoreConfig(
$this->debug, $this->dbConfig, $this->baseUrl, $this->getConfigPath() $this->debug,
$this->dbConfig,
$this->baseUrl,
$this->getConfigPath()
); );
}); });

View File

@@ -49,7 +49,8 @@ class RunMigrations implements Step
private function getMigrator() private function getMigrator()
{ {
$repository = new DatabaseMigrationRepository( $repository = new DatabaseMigrationRepository(
$this->database, 'migrations' $this->database,
'migrations'
); );
$files = new Filesystem; $files = new Filesystem;

View File

@@ -64,7 +64,9 @@ class MailServiceProvider extends AbstractServiceProvider
$this->app->singleton('mailer', function ($app) { $this->app->singleton('mailer', function ($app) {
$mailer = new Mailer( $mailer = new Mailer(
$app['view'], $app['swift.mailer'], $app['events'] $app['view'],
$app['swift.mailer'],
$app['events']
); );
if ($app->bound('queue')) { if ($app->bound('queue')) {

View File

@@ -46,7 +46,9 @@ class FulltextGambit implements GambitInterface
public function apply(AbstractSearch $search, $searchValue) public function apply(AbstractSearch $search, $searchValue)
{ {
$search->getQuery() $search->getQuery()
->whereIn('id', ->whereIn(
$this->getUserSearchSubQuery($searchValue)); 'id',
$this->getUserSearchSubQuery($searchValue)
);
} }
} }

View File

@@ -35,7 +35,8 @@ class WithTokenTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/token', 'POST',
'/api/token',
[ [
'json' => [ 'json' => [
'identification' => 'normal', 'identification' => 'normal',
@@ -66,7 +67,8 @@ class WithTokenTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/token', 'POST',
'/api/token',
[ [
'json' => [ 'json' => [
'identification' => 'normal', 'identification' => 'normal',

View File

@@ -49,7 +49,8 @@ class RequireCsrfTokenTest extends TestCase
{ {
$auth = $this->send( $auth = $this->send(
$this->request( $this->request(
'POST', '/login', 'POST',
'/login',
[ [
'json' => ['identification' => 'admin', 'password' => 'password'], 'json' => ['identification' => 'admin', 'password' => 'password'],
] ]
@@ -58,7 +59,8 @@ class RequireCsrfTokenTest extends TestCase
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/settings', 'POST',
'/api/settings',
[ [
'cookiesFrom' => $auth, 'cookiesFrom' => $auth,
'json' => ['csrf_test' => 2], 'json' => ['csrf_test' => 2],
@@ -92,7 +94,8 @@ class RequireCsrfTokenTest extends TestCase
$auth = $this->send( $auth = $this->send(
$this->request( $this->request(
'POST', '/login', 'POST',
'/login',
[ [
'cookiesFrom' => $initial, 'cookiesFrom' => $initial,
'json' => ['identification' => 'admin', 'password' => 'password'], 'json' => ['identification' => 'admin', 'password' => 'password'],
@@ -104,7 +107,8 @@ class RequireCsrfTokenTest extends TestCase
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/settings', 'POST',
'/api/settings',
[ [
'cookiesFrom' => $auth, 'cookiesFrom' => $auth,
'json' => ['csrf_test' => 2], 'json' => ['csrf_test' => 2],
@@ -135,7 +139,8 @@ class RequireCsrfTokenTest extends TestCase
$auth = $this->send( $auth = $this->send(
$this->request( $this->request(
'POST', '/login', 'POST',
'/login',
[ [
'cookiesFrom' => $initial, 'cookiesFrom' => $initial,
'json' => ['identification' => 'admin', 'password' => 'password', 'csrfToken' => $token], 'json' => ['identification' => 'admin', 'password' => 'password', 'csrfToken' => $token],
@@ -147,7 +152,8 @@ class RequireCsrfTokenTest extends TestCase
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/settings', 'POST',
'/api/settings',
[ [
'cookiesFrom' => $auth, 'cookiesFrom' => $auth,
'json' => ['csrf_test' => 2, 'csrfToken' => $token], 'json' => ['csrf_test' => 2, 'csrfToken' => $token],
@@ -172,7 +178,8 @@ class RequireCsrfTokenTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/settings', 'POST',
'/api/settings',
[ [
'json' => ['csrf_test' => 2], 'json' => ['csrf_test' => 2],
] ]
@@ -200,7 +207,8 @@ class RequireCsrfTokenTest extends TestCase
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/settings', 'POST',
'/api/settings',
[ [
'json' => ['csrf_test' => 2], 'json' => ['csrf_test' => 2],
] ]

View File

@@ -48,7 +48,8 @@ class CreationTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/users', 'POST',
'/api/users',
[ [
'json' => ['data' => ['attributes' => []]], 'json' => ['data' => ['attributes' => []]],
] ]
@@ -91,7 +92,8 @@ class CreationTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/users', 'POST',
'/api/users',
[ [
'json' => [ 'json' => [
'data' => [ 'data' => [
@@ -123,7 +125,8 @@ class CreationTest extends TestCase
{ {
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/users', 'POST',
'/api/users',
[ [
'json' => [ 'json' => [
'data' => [ 'data' => [
@@ -158,7 +161,8 @@ class CreationTest extends TestCase
$response = $this->send( $response = $this->send(
$this->request( $this->request(
'POST', '/api/users', 'POST',
'/api/users',
[ [
'json' => [ 'json' => [
'data' => [ 'data' => [