Repository navigation
Conversation
Updated the return type documentation for the get method to clarify possible return values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a suggestion about
get()behaviour in3.2-dev.3.1returned an empty string if the value set wasNULLorFALSEand returnedFALSEif the key did not exist, so there was a way to distinguish existing and non-existing keys. With the change made in3.2-devthis distinction cannot be made. It now returnsFALSEforbool(false)and for non-existing keys. It makes much more sense to returnNULLif the key is non-existent orsettype()fails. Alsosettype()throws an exception in PHP 8.0+( which also supports theNULLreturn type), which most of the people will use nowadays or with this repo.This pull request makes small but important changes to the
Cache_redisdriver to improve its return value consistency and documentation. The main focus is on ensuring that thegetmethod consistently returnsNULLinstead ofFALSEwhen a cache entry is missing or cannot be properly converted, and on updating the method's documentation to reflect possible exceptions.Return value consistency:
getmethod to returnNULLinstead ofFALSEwhen a cache entry is missing, cannot be converted, or when the type is unsupported, aligning with typical PHP caching expectations.Documentation improvements:
@returnannotation in thegetmethod's docblock to clarify thatNULLis returned if the key does not exist or type conversion fails, and added an@throwsannotation forValueErrorin PHP 8+.