Skip to content

Commit f26e0c9

Browse files
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"
1 parent acf56a4 commit f26e0c9

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
@@ -994,7 +994,8 @@ parameter:
994994
.. tip::
995995

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

9991000
Priority Parameter
10001001
~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)