-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Deprecate doctrine/cache
in favor of psr/cache
#4624
Conversation
doctrine/cache
in favor of psr/cache
To be retargeted to 3.3.x once 3.2.0 is released. |
This should target 3.3.x. 🙂 |
IMO we should not create 3.3.x before 3.2.0 is released: that would make the 3-steps-merges-up @morozov performs on a regular basis 4-steps-merges-up. Converting this to draft will prevent merges, and adding it to milestone 3.3.0 should prevent us from forgetting it when the time comes. |
All right. I've converted its follow-up #4626 to a draft as well. |
Why do we need another minor release to deprecate the old cache? |
So that calling (Doctrine, but not necessarily) projects can use the new API and have their callers not experience deprecations these callers cannot fix. |
fd1e643
to
5a9a5a5
Compare
This is the thing I never understood about runtime deprecations. The API is deprecated. As a consumer, you should be able to disable them at runtime, it shouldn't require another release to support two ways to communicate the deprecation. |
We can also deprecate them in the same minor release - we've taken this strategy to defer announcing deprecations using a deprecation library to a later release if the deprecation is in the hot path to avoid hundreds of deprecation warnings. In this case, this is even more important because in many cases, the user is not the one calling these methods (e.g., the Symfony bundle configures these calls). |
Yes, IMO the best DX is when you have no deprecation to disable because you can act on all of them immediately. In our case, we know we need to address these deprecations in our dependent packages, so let's use that knowledge and let our users know about the deprecations when we have addressed them ourselves. |
I believe this argument is irrelevant given that the current implementation triggers once per call.
This way, we're introducing coupling of a lower-level entity (cache library) to a higher-level one (its consumer, regardless of whether it's maintained within the same org). It might make sense if the deprecation library only triggered the deprecation if a deprecated API was used directly from within the application code, not through a dependency. |
Oh right, I just read the docs and indeed, there is de-duplication based on the link. @derrabus sorry, but I think in this case, you can ignore my comment. It comes from a situation with |
So why do we need to need to have another minor release to release these deprecations? The whole point of using runtime deprecations is to make them visible to the user. If there is a case when the existing deprecations would be false positives, it should be fixed at the deprecation layer, not by introducing a two-phase deprecation process. |
I changed the milestone to 3.2.0, I thought that would make it clear that I no longer think we need another minor release, but if you want me to argue that point again for the pleasure of having an argument, I can give it another try 😛
One could say here "visible to the user if and only if they can act on it by adapting their code".
Not really false positives, because unfixable deprecations are still legitimate, but are sent to the wrong recipient. To fix that in the deprecation layer, we could have a backtrace analysis that detects where the calling code resides: in the root package or in another package, much like what I've done in the phpunit-bridge, and silence that. Fair warning though: it's complex code that is hard to test, with many edge-cases to handle (code from stdin, code from phars, non standard vendor directories, deprecations triggered when parsing a config file owned by the user). |
I'll adjust the PR for 3.2 then. 🙂 |
I apologize. I did notice the change in the milestone but I didn't realize that this is the next minor.
Agree. This is why I believe the deprecation library could use an improvement.
Correct, and the library already does that to determine whether the call comes from within the same library that triggers the deprecation.
While it's true, it shouldn't be used as a reason to not improve the library. The library must act as a no-op in production. In the development environment, the risks of the library misbehaving should be accepted by developers. In the end, it's there for their own good. Otherwise, they can always disable the reporting (which is disabled by default). |
I guess I'll open yet another RFC then 🙂 |
5a9a5a5
to
a114b79
Compare
PR is ready again. |
Thanks @derrabus ! |
Summary
Follows #4620 by adding triggers for deprecation warnings for the old Doctrine Cache related methods.