-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Add type aliases for allowed types in OptionsResolver #12602
Add type aliases for allowed types in OptionsResolver #12602
Conversation
Improves DX by allowing type names that does not correspond 1 to 1 with php is_ functions. integer => int boolean => bool double => float
As this is a bug fix, 2.3 is the correct branch. Instead of creating a test file just for this bug, I would include the test in the current ones. |
Moved the test into the other test case and changed the name a bit. @fabpot should be ready now. |
ping @fabpot |
a testcase for "double" is missing? |
@timglabisch well it tests that it uses the alias map, not sure we need one for every entry in the alias map. |
@henrikbjorn adding such a testcase would prevent me from createing a pull request that removes the double entry. your choice :) |
Can't the pb be fixed at the error message level? I fear adding this might just add confusion. |
👍 for error message level |
As far as I understand the issue it's not about a badly worded error message, but it's a feature that doesn't work at the moment. You define your option to be of type |
This is not a bug fix but a new feature. |
In the original issue #12586 I proposed 3 solutions, that's why it wasn't me making a PR. :) But yea, making aliases sounds like a new feature |
👍 for this. PHP has these aliases when casting, so it makes sense to support them when validating the type. |
Thank you @henrikbjorn. |
I've adapted the patch for 2.7 as the component is much different. |
Improves DX by allowing type names that does not correspond 1 to 1
with php is_ functions.
integer => int
boolean => bool
double => float
(have one for 2.6 branch aswell, but cant never remember what branch i am supposed to base stuff off)