-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Implement psr/cache 3 #41290
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
This comment has been minimized.
This comment has been minimized.
186e22f
to
76ce5bd
Compare
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'm fine dropping support for v1 and adding types to parameters!
Before merging, and as much as I want this to be merged, let's take this PR as an opportunity to put our plan in practice: adding any return types in 6.0 must first issue a deprecation notice in 5.4.
This can be done by setting DebugClassLoader
in deprecation
mode by default:
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/ErrorHandler/DebugClassLoader.php#L39
There is a direct link with https://wiki.php.net/rfc/internal_method_return_types also, which we should account for/rely on by eg reusing the attribute.
@@ -306,7 +290,7 @@ public function reset() | |||
$this->clear(); | |||
} | |||
|
|||
private function generateItems(array $keys, $now, $f) | |||
private function generateItems(array $keys, $now, $f): \Generator |
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.
all additions to private (and final if any) methods should be split on a lower branch
Indeed. Shall we resurrect #33228?
Is there a list of methods anywhere that are affected by the RFC? We should make sure that if we override/polyfill any of those they should have the correct return type in 6.0 |
why not, if you think we need an issue for that :)
not really, that maybe: https://github.com/php/php-src/pull/6548/files?file-filters%5B%5D=.h |
I think the DebugClassLoader should be improved to require an opt-in from the class to decide that its next major version will add a return type instead of just relying on the presence of The ideal solution would of course be that PHP exposes the tentative return type to userland instead of reserving it for internal classes. but anyway, this discussion probably deserves its own issue |
btw, the explicit opt-in for parent classes would allow us to activate that behavior by default in DebugClassLoader. As long as it requires projects to run the DebugClassLoader in a special mode, we don't have a graceful migration path for our users, as they won't get the warnings (because they won't even know that this special mode exists). |
Adding the parameter types is lot more fun because the integration tests are not ready for that. 🙈 Will do that in a separate PR. |
Should be updated with argument types, taking some changes from #41424 |
76ce5bd
to
14c4ff9
Compare
14c4ff9
to
4330526
Compare
Signed-off-by: Alexander M. Turek <me@derrabus.de>
4330526
to
71d76c4
Compare
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'm merging to move this forward, we'll handle the deprecation path for all components at once anyway.)
Thank you @derrabus. |
Thank you for completing this PR, @nicolas-grekas! |
This PR adds the necessary return types to support version 3 of the
psr/cache
interfaces. I did not add parameter types in order to maintain v1 compatibility, but we could as well decide to drop v1 if we want.