Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handlers types #3193

Merged
merged 4 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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