diff --git a/framework/core/src/Admin/AdminServiceProvider.php b/framework/core/src/Admin/AdminServiceProvider.php index ce7a6b462..a1f0cfa84 100644 --- a/framework/core/src/Admin/AdminServiceProvider.php +++ b/framework/core/src/Admin/AdminServiceProvider.php @@ -18,8 +18,8 @@ use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\Application; use Flarum\Foundation\ErrorHandling\Registry; use Flarum\Foundation\ErrorHandling\Reporter; -use Flarum\Foundation\ErrorHandling\ViewRenderer; -use Flarum\Foundation\ErrorHandling\WhoopsRenderer; +use Flarum\Foundation\ErrorHandling\ViewFormatter; +use Flarum\Foundation\ErrorHandling\WhoopsFormatter; use Flarum\Foundation\Event\ClearingCache; use Flarum\Frontend\AddLocaleAssets; use Flarum\Frontend\AddTranslations; @@ -57,7 +57,7 @@ class AdminServiceProvider extends AbstractServiceProvider // All requests should first be piped through our global error handler $pipe->pipe(new HttpMiddleware\HandleErrors( $app->make(Registry::class), - $app->inDebugMode() ? $app->make(WhoopsRenderer::class) : $app->make(ViewRenderer::class), + $app->inDebugMode() ? $app->make(WhoopsFormatter::class) : $app->make(ViewFormatter::class), $app->tagged(Reporter::class) )); diff --git a/framework/core/src/Api/ApiServiceProvider.php b/framework/core/src/Api/ApiServiceProvider.php index abe53ef91..807b0ff19 100644 --- a/framework/core/src/Api/ApiServiceProvider.php +++ b/framework/core/src/Api/ApiServiceProvider.php @@ -20,7 +20,7 @@ use Flarum\Event\ConfigureMiddleware; use Flarum\Event\ConfigureNotificationTypes; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\Application; -use Flarum\Foundation\ErrorHandling\JsonApiRenderer; +use Flarum\Foundation\ErrorHandling\JsonApiFormatter; use Flarum\Foundation\ErrorHandling\Registry; use Flarum\Foundation\ErrorHandling\Reporter; use Flarum\Http\Middleware as HttpMiddleware; @@ -52,7 +52,7 @@ class ApiServiceProvider extends AbstractServiceProvider $pipe->pipe(new HttpMiddleware\HandleErrors( $app->make(Registry::class), - $app->make(JsonApiRenderer::class), + $app->make(JsonApiFormatter::class), $app->tagged(Reporter::class) )); diff --git a/framework/core/src/Api/Client.php b/framework/core/src/Api/Client.php index 684a00a55..6edc6a9ad 100644 --- a/framework/core/src/Api/Client.php +++ b/framework/core/src/Api/Client.php @@ -12,7 +12,7 @@ namespace Flarum\Api; use Exception; -use Flarum\Foundation\ErrorHandling\JsonApiRenderer; +use Flarum\Foundation\ErrorHandling\JsonApiFormatter; use Flarum\Foundation\ErrorHandling\Registry; use Flarum\User\User; use Illuminate\Contracts\Container\Container; @@ -79,7 +79,7 @@ class Client throw $e; } - return (new JsonApiRenderer)->format($error, $request); + return (new JsonApiFormatter)->format($error, $request); } } } diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index a6f6faf1e..2649e01c5 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -20,8 +20,8 @@ use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\Application; use Flarum\Foundation\ErrorHandling\Registry; use Flarum\Foundation\ErrorHandling\Reporter; -use Flarum\Foundation\ErrorHandling\ViewRenderer; -use Flarum\Foundation\ErrorHandling\WhoopsRenderer; +use Flarum\Foundation\ErrorHandling\ViewFormatter; +use Flarum\Foundation\ErrorHandling\WhoopsFormatter; use Flarum\Foundation\Event\ClearingCache; use Flarum\Frontend\AddLocaleAssets; use Flarum\Frontend\AddTranslations; @@ -67,7 +67,7 @@ class ForumServiceProvider extends AbstractServiceProvider // All requests should first be piped through our global error handler $pipe->pipe(new HttpMiddleware\HandleErrors( $app->make(Registry::class), - $app->inDebugMode() ? $app->make(WhoopsRenderer::class) : $app->make(ViewRenderer::class), + $app->inDebugMode() ? $app->make(WhoopsFormatter::class) : $app->make(ViewFormatter::class), $app->tagged(Reporter::class) )); diff --git a/framework/core/src/Foundation/ErrorHandling/Formatter.php b/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php similarity index 95% rename from framework/core/src/Foundation/ErrorHandling/Formatter.php rename to framework/core/src/Foundation/ErrorHandling/HttpFormatter.php index ec7eb4756..27a383aed 100644 --- a/framework/core/src/Foundation/ErrorHandling/Formatter.php +++ b/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php @@ -14,7 +14,7 @@ namespace Flarum\Foundation\ErrorHandling; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -interface Formatter +interface HttpFormatter { public function format(HandledError $error, Request $request): Response; } diff --git a/framework/core/src/Foundation/ErrorHandling/JsonApiRenderer.php b/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php similarity index 94% rename from framework/core/src/Foundation/ErrorHandling/JsonApiRenderer.php rename to framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php index 948f8ae8f..87e1921ec 100644 --- a/framework/core/src/Foundation/ErrorHandling/JsonApiRenderer.php +++ b/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php @@ -16,7 +16,7 @@ use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Tobscure\JsonApi\Document; -class JsonApiRenderer implements Formatter +class JsonApiFormatter implements HttpFormatter { public function format(HandledError $error, Request $request): Response { diff --git a/framework/core/src/Foundation/ErrorHandling/ViewRenderer.php b/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php similarity index 98% rename from framework/core/src/Foundation/ErrorHandling/ViewRenderer.php rename to framework/core/src/Foundation/ErrorHandling/ViewFormatter.php index 438a2d9d6..12664bbd2 100644 --- a/framework/core/src/Foundation/ErrorHandling/ViewRenderer.php +++ b/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php @@ -18,7 +18,7 @@ use Psr\Http\Message\ServerRequestInterface as Request; use Symfony\Component\Translation\TranslatorInterface; use Zend\Diactoros\Response\HtmlResponse; -class ViewRenderer implements Formatter +class ViewFormatter implements HttpFormatter { /** * @var ViewFactory diff --git a/framework/core/src/Foundation/ErrorHandling/WhoopsRenderer.php b/framework/core/src/Foundation/ErrorHandling/WhoopsFormatter.php similarity index 93% rename from framework/core/src/Foundation/ErrorHandling/WhoopsRenderer.php rename to framework/core/src/Foundation/ErrorHandling/WhoopsFormatter.php index 7be647558..549ea8a0a 100644 --- a/framework/core/src/Foundation/ErrorHandling/WhoopsRenderer.php +++ b/framework/core/src/Foundation/ErrorHandling/WhoopsFormatter.php @@ -15,7 +15,7 @@ use Franzl\Middleware\Whoops\WhoopsRunner; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; -class WhoopsRenderer implements Formatter +class WhoopsFormatter implements HttpFormatter { public function format(HandledError $error, Request $request): Response { diff --git a/framework/core/src/Http/Middleware/HandleErrors.php b/framework/core/src/Http/Middleware/HandleErrors.php index 94d749f8b..470c379fd 100644 --- a/framework/core/src/Http/Middleware/HandleErrors.php +++ b/framework/core/src/Http/Middleware/HandleErrors.php @@ -11,7 +11,7 @@ namespace Flarum\Http\Middleware; -use Flarum\Foundation\ErrorHandling\Formatter; +use Flarum\Foundation\ErrorHandling\HttpFormatter; use Flarum\Foundation\ErrorHandling\Registry; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; @@ -27,7 +27,7 @@ class HandleErrors implements Middleware protected $registry; /** - * @var Formatter + * @var HttpFormatter */ protected $formatter; @@ -36,7 +36,7 @@ class HandleErrors implements Middleware */ protected $reporters; - public function __construct(Registry $registry, Formatter $formatter, array $reporters) + public function __construct(Registry $registry, HttpFormatter $formatter, array $reporters) { $this->registry = $registry; $this->formatter = $formatter; diff --git a/framework/core/src/Install/Installer.php b/framework/core/src/Install/Installer.php index ba4e2c098..587a5d099 100644 --- a/framework/core/src/Install/Installer.php +++ b/framework/core/src/Install/Installer.php @@ -14,7 +14,7 @@ namespace Flarum\Install; use Flarum\Foundation\AppInterface; use Flarum\Foundation\ErrorHandling\Registry; use Flarum\Foundation\ErrorHandling\Reporter; -use Flarum\Foundation\ErrorHandling\WhoopsRenderer; +use Flarum\Foundation\ErrorHandling\WhoopsFormatter; use Flarum\Http\Middleware\DispatchRoute; use Flarum\Http\Middleware\HandleErrors; use Flarum\Http\Middleware\StartSession; @@ -42,7 +42,7 @@ class Installer implements AppInterface $pipe = new MiddlewarePipe; $pipe->pipe(new HandleErrors( $this->container->make(Registry::class), - $this->container->make(WhoopsRenderer::class), + $this->container->make(WhoopsFormatter::class), $this->container->tagged(Reporter::class) )); $pipe->pipe($this->container->make(StartSession::class));