Closed felixfbecker closed 7 years ago
A controller like this:
$app->get('/hello/{world}', function (string $world = 'world') { });
should work with this request:
GET /hello
but fails with
Controller requires that you provide a value for the "$world" argument.
This is because the ResolverChain used for resolving the controller parameters does not include a DefaultValueResolver:
ResolverChain
DefaultValueResolver
https://github.com/PHP-DI/Silex-Bridge/blob/master/src/Application.php#L77
:+1: I don't remember if there's a reason for that, but my reasoning would be: if it doesn't break any test then it's safe to add the DefaultValueResolver ;)
Thank you for the PR, I've tagged 1.5.2
A controller like this:
should work with this request:
but fails with
This is because the
ResolverChain
used for resolving the controller parameters does not include aDefaultValueResolver
:https://github.com/PHP-DI/Silex-Bridge/blob/master/src/Application.php#L77