fix: setMultiple and deleteMultiple must only return boolean #62
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.
with phpstan level 3 it correctly detects that setMultiple and deleteMultiple must only return boolean.
php-fig/simple-cache#24 explicitly added the boolean return type to these methods, released in major version 3. That was released for PHP 8.
But we currently support PHP 7.4 also. That causes
psr/simple-cache
major version 1 to still be used. That declares the return type only in PHPdoc (which phpstan is finding).Probably the current code works fine if someone is checking for an array in the return value, and processing it to find out what went wrong (if anything). So the change in this PR would break that. PHP 7.4 is not going to fall over at run-time just because setMultiple or deleteMultiple returns something not declared in the PHP doc.
So I will leave this here for now - probably better to sort this out with a major version some day, along with dropping PHP 7.4 support and bringing in
psr/simple-cache
v2 and then v3.Also should have unit tests that check the return value.