[12.x] Allow Unit & Backed enums for cache stores#55172
[12.x] Allow Unit & Backed enums for cache stores#55172michaeldyrynda wants to merge 3 commits intolaravel:12.xfrom
Conversation
|
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
|
Opened this as draft so as to get feedback on whether test approach 1 (updating existing tests) or 2 (effectively duplicating the tests) is the preferred method. I'll implement for the other cache stores once a direction is chosen. |
| * Retrieve an item from the cache by key. | ||
| * | ||
| * @param string $key | ||
| * @param \BackedEnum|\UnitEnum|string $key |
There was a problem hiding this comment.
Btw, BackedEnum is a UnitEnum, so I'd say, technically, UnitEnum would suffice
There was a problem hiding this comment.
Whilst technically true, the use of both in docblocks is consistent with similar behaviour elsewhere in the framework.
678cdaa to
5073b37
Compare
This PR enables us to use
BackedEnumandUnitEnumvalues for cache keys, where previously only strings were possible.In doing so, we can mitigate against typos when working with cache keys.