Skip to content
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

[9.x] Improves Cache facade types #45467

Merged
merged 2 commits into from Dec 31, 2022
Merged

[9.x] Improves Cache facade types #45467

merged 2 commits into from Dec 31, 2022

Conversation

nunomaduro
Copy link
Member

This pull request improves Cache facade types, as initial proposed by #45325. So, the following types are correctly inferred by PHPStan, and hopefully, in the future, by PHPStorm:

Cache::get('key')); // mixed
Cache::get('key', 1)); // int
Cache::get('key', fn () => 1); // int

Cache::pull('key')); // mixed
Cache::pull('key', 1)); // int
Cache::pull('key', fn () => 1); // int

Cache::sear('key', fn () => 1); // int
Cache::remember('key', now(), fn () => 1); // int
Cache::rememberForever('key', fn () => 1); // int

@nunomaduro nunomaduro marked this pull request as ready for review December 30, 2022 15:26
@taylorotwell taylorotwell merged commit 732a29a into 9.x Dec 31, 2022
@taylorotwell taylorotwell deleted the generic-cache branch December 31, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants