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

Wrong stub for Redis::getDbNum() ? #3673

Closed
greg0ire opened this issue Jun 25, 2020 · 3 comments
Closed

Wrong stub for Redis::getDbNum() ? #3673

greg0ire opened this issue Jun 25, 2020 · 3 comments
Labels

Comments

@greg0ire
Copy link
Contributor

greg0ire commented Jun 25, 2020

https://psalm.dev/r/88baf4bedf

The docs say:

Mixed Returns the database number (LONG) phpredis thinks it's pointing to or FALSE if we're not connected

yet Psalm seems to think it is guaranteed to return an integer.

@psalm-github-bot
Copy link

psalm-github-bot bot commented Jun 25, 2020

I found these snippets:

https://psalm.dev/r/88baf4bedf
<?php

$redis = new Redis;

assert(is_integer($redis->getDbNum()));
Psalm output (using commit f458959):

ERROR: RedundantCondition - 5:8 - int always contains int

@weirdan weirdan added the bug label Jun 26, 2020
@weirdan
Copy link
Collaborator

weirdan commented Jun 26, 2020

Yeah, it may return false: https://github.com/phpredis/phpredis/blob/a311cc4ec3cecdbaf83ba66985efa82137e37cc0/redis.c#L3368-L3377

@weirdan
Copy link
Collaborator

weirdan commented Jun 26, 2020

Closed by c42dada

@weirdan weirdan closed this as completed Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants