Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:4.2fromvoronkovich:fix-routing-method-default-value
Apr 3, 2019
Merged

[Routing] Fix: annotation loader ignores method's default values#30825

fabpot merged 1 commit intosymfony:4.2fromvoronkovich:fix-routing-method-default-value
Apr 3, 2019

Conversation

@voronkovich
Copy link
Contributor

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsno
LicenseMIT
Doc PRno

In some cases annotation loader ignores method param's default values.
For example this code won't work as expected:

/** * @Route("/hello/{name<\w++>}", methods="GET", name="hello") */publicfunctionhello(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),    ]);}

@nicolas-grekas
Copy link
Member

Note that 4.1 is EOLed, this is for 4.2.

@nicolas-grekasnicolas-grekas changed the base branch from4.1 to4.2April 3, 2019 13:26
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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 reacted with thumbs up emoji
@voronkovich
Copy link
ContributorAuthor

@nicolas-grekas, thank you for the help!

@fabpot
Copy link
Member

Thank you@voronkovich.

@fabpotfabpot merged commit9b37793 intosymfony:4.2Apr 3, 2019
fabpot added a commit that referenced this pull requestApr 3, 2019
…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
@fabpotfabpot mentioned this pull requestApr 16, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

4 participants

@voronkovich@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp