Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment has been minimized.
This comment has been minimized.
186e22f to76ce5bdCompare
nicolas-grekas left a comment
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 settingDebugClassLoader indeprecation mode by default:
https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/ErrorHandler/DebugClassLoader.php#L39
There is a direct link withhttps://wiki.php.net/rfc/internal_method_return_types also, which we should account for/rely on by eg reusing the attribute.
| } | ||
| privatefunctiongenerateItems(array$keys,$now,$f) | ||
| privatefunctiongenerateItems(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
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
derrabus commentedMay 20, 2021
Indeed. Shall we resurrect#33228?
Is there a list of methods anywhere that are affected by the RFC? We should make sure thatif we override/polyfill any of those they should have the correct return type in 6.0 |
nicolas-grekas commentedMay 20, 2021
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 |
stof commentedMay 20, 2021
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 |
stof commentedMay 20, 2021
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, wedon'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). |
derrabus commentedMay 20, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Adding the parameter types is lot more fun because the integration tests are not ready for that. 🙈 Will do that in a separate PR. |
nicolas-grekas commentedJun 8, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Should be updated with argument types, taking some changes from#41424 |
76ce5bd to14c4ff9Compare14c4ff9 to4330526CompareSigned-off-by: Alexander M. Turek <me@derrabus.de>
4330526 to71d76c4Compare
nicolas-grekas left a comment
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.)
nicolas-grekas commentedJul 7, 2021
Thank you@derrabus. |
derrabus commentedJul 7, 2021
Thank you for completing this PR,@nicolas-grekas! |
This PR adds the necessary return types to support version 3 of the
psr/cacheinterfaces. I did not add parameter types in order to maintain v1 compatibility, but we could as well decide to drop v1 if we want.