Closed Tastaturberuf closed 7 years ago
Your code is a BC break. If I used \Haste\Input\Input::post('foobar', true)
my code will no longer work. Thus I think you should move the default parameter to the last position in the arguments list... but then it would be uncomfortable to use it.
It works in Symfony because the getter there does not accept extra params such as decodeEntities
or has consistent argument order, e.g. $name, $default, $options
. Not possible here in my opinion.
Ooops. I don't think enough about that. One possibility is to use new method names like
Input::getDefault(...)
Input::postDefault(...)
Input::postHtmlDefault(...)
Input::postRawDefault(...)
Input::postUnsafeRawDefault(...)
or use an additional Class like InputDefault
.
What do you think about that?
Yeah that would work but does it make sense to have yet another class just for that ternary operator? I mean I like the concept but only if it's in the same place (Symfony does that), i.e. same class/method as regular fetch of the value. The separate class just for that does not look handy to me.
@Toflar @aschempp
I don't see the advantage really. It's handy when it's the 2nd parameter as it is in SF but we cannot have that and I honestly don't see why we'd need that here.
Yep, that isn't handy.
Now we can use
instead of
It's more readable when you use it directly as params like
instead of
I know this is a very little change but i use this very often and get confused from the syntax.