Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[DX] [Form] Use constants for form options #21727
In Symfony Forms, the form type options keys are defined as strings, like
Let's defining a constant for each one of these options!
A few examples:
A benefit could be making sure you don't make typos when you write the options in a field/form.
Note that it won't create any BC break.
Thoughts? Pros / cons?
Impossible, because types inheritance has nothing to do with PHP inheritance.
There are too many classes defining options, using only one like
Thanks for your proposal @pimolo but I'm
Also the options are not that hard to remember (read the manual a few time, use it a few times and it becomes natural), using constants for HTTP status codes is usable because not everyone remembers what 401 means, using constants for flags instead of having to remember bit positions (which can be actually change at any time) is is good use-case.
But for this situation it feels like heavy overkill, also