Convention about failure handler in middleware should be written.
Because each failure handler is specific for each middleware, so it shouldn't implement RequestHandlerInterface. So separate failure handler interface should be created for each middleware.
Example:
interface AuthenticationFailureHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface;
}
When failure handler requires some context, it should be a second parameter in handle() metod. For example:
interface ThrowableHandlerInterface
{
public function create(ServerRequestInterface $request, Throwable $throwable): ResponseInterface;
}
Related PRs:
Convention about failure handler in middleware should be written.
Because each failure handler is specific for each middleware, so it shouldn't implement
RequestHandlerInterface. So separate failure handler interface should be created for each middleware.Example:
When failure handler requires some context, it should be a second parameter in
handle()metod. For example:Related PRs: