Since Symfony 4.1, route parameters may declared optional/nullable:
To give a null default value to any parameter, add nothing after the ? character (e.g. /blog/{page?}). If you do this, don't forget to update the types of the related controller arguments to allow passing null values (e.g. replace int $page by ?int $page).
Such parameters are then represented in generated list of routes in the defaults node like this (JSON):
"defaults": {
"page": null
},
Unfortunately the RouteDefaults interface only allows value to be a string. This PR adds support of null to the interface to comply with the Symfony behavior.
Since Symfony 4.1, route parameters may declared optional/nullable:
Such parameters are then represented in generated list of routes in the
defaults
node like this (JSON):Unfortunately the
RouteDefaults
interface only allows value to be astring
. This PR adds support ofnull
to the interface to comply with the Symfony behavior.