Skip to content

Commit 25428e8

Browse files
committed
minor #17188 [Cache] Add use Response & return hint (mohamedGasmii)
This PR was submitted for the 5.4 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Cache] Add use Response & return hint <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 6868736 [Cache] Add use Response & return hint
2 parents c0ee11b + 6868736 commit 25428e8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

http_cache/validation.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ content::
5656

5757
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
5858
use Symfony\Component\HttpFoundation\Request;
59+
use Symfony\Component\HttpFoundation\Response;
5960

6061
class DefaultController extends AbstractController
6162
{
62-
public function homepage(Request $request)
63+
public function homepage(Request $request): Response
6364
{
6465
$response = $this->render('static/homepage.html.twig');
6566
$response->setEtag(md5($response->getContent()));
@@ -138,7 +139,7 @@ header value::
138139

139140
class ArticleController extends AbstractController
140141
{
141-
public function show(Article $article, Request $request)
142+
public function show(Article $article, Request $request): Response
142143
{
143144
$author = $article->getAuthor();
144145

@@ -196,7 +197,7 @@ the better. The ``Response::isNotModified()`` method does exactly that::
196197

197198
class ArticleController extends AbstractController
198199
{
199-
public function show($articleSlug, Request $request)
200+
public function show(string $articleSlug, Request $request): Response
200201
{
201202
// Get the minimum information to compute
202203
// the ETag or the Last-Modified value

0 commit comments

Comments
 (0)