Skip to content

Commit af0422e

Browse files
authored
Update forwarding.rst
1 parent 88cf74d commit af0422e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

controller/forwarding.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ Instead of redirecting the user's browser, this makes an "internal" sub-request
1313
and calls the defined controller. The ``forward()`` method returns the
1414
:class:`Symfony\\Component\\HttpFoundation\\Response` object that is returned
1515
from *that* controller::
16+
17+
// src/Controller/OneController.php
1618

17-
public function index($name)
19+
public function index($name): Response
1820
{
1921
$response = $this->forward('App\Controller\OtherController::fancy', [
2022
'name' => $name,
@@ -29,7 +31,9 @@ from *that* controller::
2931
The array passed to the method becomes the arguments for the resulting controller.
3032
The target controller method might look something like this::
3133

32-
public function fancy($name, $color)
34+
// src/Controller/OtherController.php
35+
36+
public function fancy(string $name, string $color): Response
3337
{
3438
// ... create and return a Response object
3539
}

0 commit comments

Comments
 (0)