-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Migration from Form AbstractType setDefaultOptions() to configureOptions broken by concrete injection #14827
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
Comments
Is there a specific reason the signature was changed to concrete? I can see that @peterrehm made the change in 3d43cae, but I don't see an explanation for the switch. |
We haven't implemented the interface, but I'm curious as to why there is a break in the use of Interface Injection in this specific instance. I can certainly go back and change all of those classes to use the new signature, but I'm not keen on it without understanding why the deviation from normal practice is there in the first place. |
As written in UPGRADE-2.6.md:
Closing, as this is not a bug. |
So essentially, other implementations of OptionsResolver are no longer supported? The quote from the UPGRADE document doesn't really address the question as to why. Sharing of the instances seems to have little to do with InterfaceInjection. Am I missing something? Forgive me if this is a stupid question. |
We simply don't want to support alternative implementations of the OptionsResolver. |
The point is that working with interfaces makes it hard to impossible to improve the optionsresolver itself since we cannot introduce new/changed methods in the inteface without breaking bc. But we can easily add new methods to the optionsresolver implementation. So in this case we decided it's not worth to provide an interface that nobody would reimplement anyway. |
@Tobion - makes sense; thank you for explaining the why. I will migrate those with the updated signature. Cheers |
Since ::setDefaultOptions() required an interface, you could inject any OptionResolver interface. The ::configureOptions method requires a concrete type instead. The largest impact is that any overriding method will throw a notice due to the mismatched signature.
The text was updated successfully, but these errors were encountered: