@@ -601,10 +601,10 @@ Returning JSON Response
601601To return JSON from a controller, use the ``json() `` helper method. This returns a
602602``JsonResponse `` object that encodes the data automatically::
603603
604- use Symfony\Component\HttpFoundation\Response ;
604+ use Symfony\Component\HttpFoundation\JsonResponse ;
605605 // ...
606606
607- public function index(): Response
607+ public function index(): JsonResponse
608608 {
609609 // returns '{"username":"jane.doe"}' and sets the proper Content-Type header
610610 return $this->json(['username' => 'jane.doe']);
@@ -623,10 +623,10 @@ Streaming File Responses
623623You can use the :method: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ AbstractController::file `
624624helper to serve a file from inside a controller::
625625
626- use Symfony\Component\HttpFoundation\Response ;
626+ use Symfony\Component\HttpFoundation\BinaryFileResponse ;
627627 // ...
628628
629- public function download(): Response
629+ public function download(): BinaryFileResponse
630630 {
631631 // send the file contents and force the browser to download it
632632 return $this->file('/path/to/some_file.pdf');
@@ -638,7 +638,7 @@ The ``file()`` helper provides some arguments to configure its behavior::
638638 use Symfony\Component\HttpFoundation\ResponseHeaderBag;
639639 // ...
640640
641- public function download(): Response
641+ public function download(): BinaryFileResponse
642642 {
643643 // load the file from the filesystem
644644 $file = new File('/path/to/some_file.pdf');
0 commit comments