From 59e143e0e92c7e63b23be46c4edc517d9d401dfd Mon Sep 17 00:00:00 2001 From: Ashley Coles Date: Wed, 4 May 2022 16:48:38 +0100 Subject: [PATCH 1/3] Adding types to ErrorHandler --- Slim/Handlers/ErrorHandler.php | 60 +++++++--------------------------- 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/Slim/Handlers/ErrorHandler.php b/Slim/Handlers/ErrorHandler.php index d381e5dba..c439a9444 100644 --- a/Slim/Handlers/ErrorHandler.php +++ b/Slim/Handlers/ErrorHandler.php @@ -46,10 +46,7 @@ */ class ErrorHandler implements ErrorHandlerInterface { - /** - * @var string - */ - protected $defaultErrorRendererContentType = 'text/html'; + protected string $defaultErrorRendererContentType = 'text/html'; /** * @var ErrorRendererInterface|string|callable @@ -72,60 +69,27 @@ class ErrorHandler implements ErrorHandlerInterface 'text/plain' => PlainTextErrorRenderer::class, ]; - /** - * @var bool - */ - protected $displayErrorDetails; + protected bool $displayErrorDetails = false; - /** - * @var bool - */ - protected $logErrors; + protected bool $logErrors; - /** - * @var bool - */ - protected $logErrorDetails; + protected bool $logErrorDetails = false; - /** - * @var string|null - */ - protected $contentType; + protected ?string $contentType = null; - /** - * @var string - */ - protected $method; + protected ?string $method = null; - /** - * @var ServerRequestInterface - */ - protected $request; + protected ServerRequestInterface $request; - /** - * @var Throwable - */ - protected $exception; + protected Throwable $exception; - /** - * @var int - */ - protected $statusCode; + protected int $statusCode; - /** - * @var CallableResolverInterface - */ - protected $callableResolver; + protected CallableResolverInterface $callableResolver; - /** - * @var ResponseFactoryInterface - */ - protected $responseFactory; + protected ResponseFactoryInterface $responseFactory; - /** - * @var LoggerInterface - */ - protected $logger; + protected LoggerInterface $logger; /** * @param CallableResolverInterface $callableResolver From 765a2179ca0e8c3545d47606b446785a5c2d3e32 Mon Sep 17 00:00:00 2001 From: Ashley Coles Date: Wed, 4 May 2022 16:49:56 +0100 Subject: [PATCH 2/3] Adding types to RequestHandler --- Slim/Handlers/Strategies/RequestHandler.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Slim/Handlers/Strategies/RequestHandler.php b/Slim/Handlers/Strategies/RequestHandler.php index 0f5143cfa..b25305dfb 100644 --- a/Slim/Handlers/Strategies/RequestHandler.php +++ b/Slim/Handlers/Strategies/RequestHandler.php @@ -19,10 +19,7 @@ */ class RequestHandler implements RequestHandlerInvocationStrategyInterface { - /** - * @var bool - */ - protected $appendRouteArgumentsToRequestAttributes; + protected bool $appendRouteArgumentsToRequestAttributes; /** * @param bool $appendRouteArgumentsToRequestAttributes From 9ffbf377b4d8b23848adf7fedf23e0c5e3b8477e Mon Sep 17 00:00:00 2001 From: Ashley Coles Date: Wed, 4 May 2022 16:52:14 +0100 Subject: [PATCH 3/3] Missed type on ErrorHandler --- Slim/Handlers/ErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Slim/Handlers/ErrorHandler.php b/Slim/Handlers/ErrorHandler.php index c439a9444..614697220 100644 --- a/Slim/Handlers/ErrorHandler.php +++ b/Slim/Handlers/ErrorHandler.php @@ -61,7 +61,7 @@ class ErrorHandler implements ErrorHandlerInterface /** * @var array */ - protected $errorRenderers = [ + protected array $errorRenderers = [ 'application/json' => JsonErrorRenderer::class, 'application/xml' => XmlErrorRenderer::class, 'text/xml' => XmlErrorRenderer::class,