From 7c360432d20d0d7372b39025dee595d2c47a9ee5 Mon Sep 17 00:00:00 2001 From: authentictech Date: Sat, 31 Jul 2021 23:00:32 +0100 Subject: [PATCH] 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" --- routing.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index ec39d1f8e00..dd6478ac539 100644 --- a/routing.rst +++ b/routing.rst @@ -815,7 +815,8 @@ parameter: .. tip:: To give a ``null`` default value to any parameter, add nothing after the - ``?`` character (e.g. ``/blog/{page?}``). + ``?`` character (e.g. ``/blog/{page?}``). Also, remember to add the + ``?`` character before the function parameter type to make it permit null values (e.g. ``?int``) Parameter Conversion ~~~~~~~~~~~~~~~~~~~~