-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Clock] Return Symfony ClockInterface in ClockSensitiveTrait #53080
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
In the same idea, I'm not sure to clearly understand the convention in the code base on which class to use when one is available in Contracts, PSR and in the component itself (e.g. EventDispatcher)? 🤔 |
No specific reason I can think of...
See SOLID principles: use the most abstract interface when it fits your need. If you need a more capable interface, use the more capable one. |
Anytime a component only needs the API of the PSR interface, we use that as parameter type as it makes the component usable with any PSR-20 implementation and not just |
Got it, thank you both 👍 |
@ruudk please advise what you'd like to do with this PR. "Draft status" is blurry for OSS maintainers. |
I made it Draft because I wasn't sure. So I made it ready for review now. I think that the return type should be the thing that is going to be returned. That allows the developer, when using this in the test, to call |
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.
for 7.1 (this doesn't look like a bugfix to me)
I don't understand why the ClockSensitiveTrait::mockTime returns a PSR ClockInterface, instead of a Symfony ClockInterface. Is this done on purpose? Or was this a mistake?
Thank you @ruudk. |
@nicolas-grekas I don't understand why the ClockSensitiveTrait::mockTime returns a PSR ClockInterface, instead of a Symfony ClockInterface. Is this done on purpose? Or was this a mistake?