-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] force stringable object to string in route parameter #40342
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Nice!
Sorry if Fabbot suggested a bunch of CS changes. :/
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.
Thank you.
Im happy with this after two small changes.
src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>
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.
Thank you.
Im happy with this.
if (!\is_object($param)) { | ||
continue; | ||
} | ||
if (!\is_callable([$param, '__toString'])) { |
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 think a future PR can deal with if you pass an array or callable.
Or we may think that is not needed.
Oh, Fabbot saw that you missed something when adding the sprintf. :) |
I think I agree with @linaori's comments in the related issue, so mostly 👎 |
I forgot to mention that we tried to remove such string casts in the past from the framework. IIRC, @Tobion was quite vocal about this. |
Closing as 2 core team members voted against this change. |
This is a simple proposal to fix related issue.