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

phpredis method signatures are incorrect (should include false in return type hint) #9747

Closed
InvisibleSmiley opened this issue Aug 10, 2023 · 3 comments

Comments

@InvisibleSmiley
Copy link

Please send a pull request in phpstan/phpstan-src that updates file resources/functionMap.php instead. Thank you.

I don't have the time for that right now but would like to document what I found here so someone else can flesh it out.

I found that PHPStan complained that RedisArray::keys may not return false, but PhpStorm's stubs said it can.
Digging a little deeper I found that at some point in time the phpredis stubs have been updated, and consequently also the Psalm ones. Don't know who updated PhpStorm stubs, but obviously PHPStan missed it.

Related:

@mergeable
Copy link

mergeable bot commented Aug 10, 2023

Hi there! 👋

Looks like you opened an issue without following one of the issue templates:

Bug report 🐛 (open an issue)

If something isn't working as expected 🤔.

Feature request 🚀 (open an issue)

I have a suggestion (and may want to implement it 🙂)!

Support question ❓ (open a discussion)

I need some help with my code because PHPStan doesn't like it.


The current issue will be closed. This is a precaution to save maintainer's time, I hope you'll understand.

Sincerely, the bot 🤖

@mergeable mergeable bot closed this as completed Aug 10, 2023
@InvisibleSmiley
Copy link
Author

Actually PHPStan not only missed the false possibility but is also too strict regarding the array structure.
We found that RedisArray::keys returns array<string, list<string>> while PHPStan says it's an array of strings.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant