Skip to content

Commit

Permalink
Merge pull request #3193 from ashleycoles/handlersTypes
Browse files Browse the repository at this point in the history
Handlers types
  • Loading branch information
l0gicgate authored May 5, 2022
2 parents f8f1377 + 16af910 commit 187d99d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 53 deletions.
62 changes: 13 additions & 49 deletions Slim/Handlers/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@
*/
class ErrorHandler implements ErrorHandlerInterface
{
/**
* @var string
*/
protected $defaultErrorRendererContentType = 'text/html';
protected string $defaultErrorRendererContentType = 'text/html';

/**
* @var ErrorRendererInterface|string|callable
Expand All @@ -64,68 +61,35 @@ class ErrorHandler implements ErrorHandlerInterface
/**
* @var array<string|callable>
*/
protected $errorRenderers = [
protected array $errorRenderers = [
'application/json' => JsonErrorRenderer::class,
'application/xml' => XmlErrorRenderer::class,
'text/xml' => XmlErrorRenderer::class,
'text/html' => HtmlErrorRenderer::class,
'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
Expand Down
5 changes: 1 addition & 4 deletions Slim/Handlers/Strategies/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
*/
class RequestHandler implements RequestHandlerInvocationStrategyInterface
{
/**
* @var bool
*/
protected $appendRouteArgumentsToRequestAttributes;
protected bool $appendRouteArgumentsToRequestAttributes;

/**
* @param bool $appendRouteArgumentsToRequestAttributes
Expand Down

0 comments on commit 187d99d

Please # to comment.