Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Routing] Fix: annotation loader ignores method's default values#30825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedApr 3, 2019
Note that 4.1 is EOLed, this is for 4.2. |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(I rebased and addresses my review)
voronkovich commentedApr 3, 2019
@nicolas-grekas, thank you for the help! |
fabpot commentedApr 3, 2019
Thank you@voronkovich. |
…values (voronkovich)This PR was merged into the 4.2 branch.Discussion----------[Routing] Fix: annotation loader ignores method's default values| Q | A| ------------- | ---| Branch? | 4.1| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? |no| Tests pass? | yes| Fixed tickets | no| License | MIT| Doc PR | noIn some cases annotation loader ignores method param's default values.For example this code won't work as expected:```php/** *@route("/hello/{name<\w++>}", methods="GET", name="hello") */public function hello(Request $request, string $name = 'World'): Response{ // If you try to open "/hello" path an exception (No route found for "GET /hello") will be thrown. return $this->json([ 'hello' => \sprintf('Hello, %s!', $name), ]);}```Commits-------9b37793 [Routing] Fix: annotation loader ignores method's default values
In some cases annotation loader ignores method param's default values.
For example this code won't work as expected: