Skip to content

Commit 00a0c4b

Browse files
committed
minor #15572 [Routing] Update routing.rst (authentictech)
This PR was submitted for the 5.3 branch but it was merged into the 4.4 branch instead. Discussion ---------- [Routing] Update routing.rst Just adding the ? character to the route parameter without also adding ? to the function parameter type results in a TypeError: "Argument 1 passed to App\Controller\BlogController::list() must be of the type integer, null given" <!-- 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 `5.x` for features of unreleased versions). --> Commits ------- 7c36043 Update routing.rst
2 parents 7874115 + 7c36043 commit 00a0c4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,8 @@ parameter:
815815
.. tip::
816816

817817
To give a ``null`` default value to any parameter, add nothing after the
818-
``?`` character (e.g. ``/blog/{page?}``).
818+
``?`` character (e.g. ``/blog/{page?}``). Also, remember to add the
819+
``?`` character before the function parameter type to make it permit null values (e.g. ``?int``)
819820

820821
Parameter Conversion
821822
~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)