Issues (21)

src/Middleware/NoCacheMiddleware.php (1 issue)

1
<?php declare(strict_types=1);
2
3
namespace Koded\Framework\Middleware;
4
5
use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
6
use Psr\Http\Server\{MiddlewareInterface, RequestHandlerInterface};
7
8
/**
9
 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
10
 */
11
class NoCacheMiddleware implements MiddlewareInterface
12
{
13
    public function process(
14
        ServerRequestInterface $request,
15
        RequestHandlerInterface $handler): ResponseInterface
16
    {
17
        return $handler->handle($request)
0 ignored issues
show
Bug Best Practice introduced by
The expression return $handler->handle(... 'no-cache, max-age=0') returns the type Psr\Http\Message\MessageInterface which includes types incompatible with the type-hinted return Psr\Http\Message\ResponseInterface.
Loading history...
18
            ->withHeader('Cache-Control', 'no-cache, max-age=0');
19
    }
20
}
21