mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 10:40:51 +08:00
Apply fixes from StyleCI
[ci skip] [skip ci]
This commit is contained in:
parent
d7a5bf7546
commit
72f7c3cae9
|
@ -74,6 +74,7 @@ class ApiServiceProvider extends AbstractServiceProvider
|
|||
|
||||
$this->container->bind('flarum.api.error_handler', function () {
|
||||
$jsonFormatter = new JsonApiFormatter($this->container['flarum.config']->inDebugMode());
|
||||
|
||||
return new HttpMiddleware\HandleErrors(
|
||||
$this->container->make(Registry::class),
|
||||
$jsonFormatter,
|
||||
|
|
|
@ -35,7 +35,6 @@ use Flarum\Settings\Event\Saving;
|
|||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Laminas\Stratigility\MiddlewarePipe;
|
||||
use Laminas\Stratigility\MiddlewarePipeInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ForumServiceProvider extends AbstractServiceProvider
|
||||
|
@ -132,13 +131,13 @@ class ForumServiceProvider extends AbstractServiceProvider
|
|||
|
||||
$this->container->when(FrontendFormatter::class)
|
||||
->needs(MiddlewarePipeInterface::class)
|
||||
->give(function() {
|
||||
->give(function () {
|
||||
$middleware = $this->container->make('flarum.forum.middleware');
|
||||
|
||||
$pipe = new MiddlewarePipe;
|
||||
|
||||
foreach ($middleware as $middlewareClass) {
|
||||
if (!in_array($middlewareClass, [
|
||||
if (! in_array($middlewareClass, [
|
||||
'flarum.forum.error_handler',
|
||||
HttpMiddleware\InjectActorReference::class,
|
||||
HttpMiddleware\RememberFromCookie::class,
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Foundation\ErrorHandling\Middleware;
|
||||
|
||||
use Flarum\Http\RouteHandlerFactory;
|
||||
|
@ -20,7 +27,8 @@ class ExecuteErrorToFrontend implements MiddlewareInterface
|
|||
*/
|
||||
protected $handlerFactory;
|
||||
|
||||
public function __construct(string $frontend, RouteHandlerFactory $handlerFactory) {
|
||||
public function __construct(string $frontend, RouteHandlerFactory $handlerFactory)
|
||||
{
|
||||
$this->frontend = $frontend;
|
||||
$this->handlerFactory = $handlerFactory;
|
||||
}
|
||||
|
@ -34,4 +42,4 @@ class ExecuteErrorToFrontend implements MiddlewareInterface
|
|||
|
||||
return $controller($request, [])->withStatus($error->getStatusCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class Registry
|
|||
$errorType = $this->classMap[$errorClass];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$errorContent = Arr::get($this->contentMap, $errorClass);
|
||||
|
||||
if ($errorType) {
|
||||
|
|
|
@ -12,17 +12,9 @@ namespace Flarum\Http;
|
|||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Discussion\IdWithTransliteratedSlugDriver;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\ErrorHandling\FrontendFormatter;
|
||||
use Flarum\Foundation\ErrorHandling\Registry;
|
||||
use Flarum\Foundation\ErrorHandling\Reporter;
|
||||
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\Exception\NotAuthenticatedException;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Flarum\User\User;
|
||||
use Flarum\User\UsernameSlugDriver;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class HttpServiceProvider extends AbstractServiceProvider
|
||||
|
|
Loading…
Reference in New Issue
Block a user