-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Lock] Add LockFactoryInterface #39634
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
no strong opinion about this. I created a LockFactoryInyerface in the original PR (#21093) But removed afterwards (I don't remember who suggested it. Probably @nicolas-grekas if I remember well...) The factory is pretty simple and I never needed another implementation or decoration. Do you have a use-case in mind? |
The rate limiter provides bundle config like: framework:
rate_limiter:
acme:
lock_factory: # Any service that is an instance of LockFactory It does not make much sense to have a config value where you pretty much have only one valid config. Same thing with the constructor of So no, apart from these more or less academical reasons, I dont have a use-case. |
hmm, the factory take a store in argument. You may have instance of the Factory in the DIC.
provides 2 factories |
Yes, sure, you may have multiple lock factories which all would be different objects of LockFactory. But that is still missing my point of dependency inversion. |
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.
No issue on my side.
We should deprecate the LockFactory alias and add one for the new interface also.
The PR is updated. There is a lot of deprecated service names and aliases. |
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.
I've never felt I needed a different implementation of the lock factory. The factory is just a tiny bit of glue code around the store. I don't oppose this change, but I think the current way of not having an interface is just fine.
I agree that this change is mostly academical. |
By the way, I think we can remove the "BC Break" label. You've changed the constructor signature in a compatible way and the lock factory is assigned to a private variable and is never exposed. |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Show resolved
Hide resolved
I think it was me not wanting this interface and I haven't changed my mind. "academic" reasons are probably the worst :) |
Hm... I disagree with that. Thank you for reviewing and for the feedback. |
I saw that the LockFactory does not have an interface. And the RateLimit component has a config option to "Add your own lock factory".
This PR includes a BC break to our experimental RateLimiter component. But it is a super minor so I am okey with it.