Bug report
I originally filed #9747 but that was closed automatically, and there's more to it than the fact that "false" is missing.
I'd like to focus this issue on the specific RedisArray::keys issue rather than the "false missing everywhere" issue.
Actually, RedisArray::keys returns a different array structure than Redis::keys.
Quoting from https://github.com/phpredis/phpredis/blob/develop/arrays.md#limitations:
Running KEYS() on a RedisArray object will execute the command on each node and return an associative array of keys, indexed by host name.
Right now, PHPStan seems to reuse the Redis::keys definition for RedisArray::keys, which currently reads:
array<int,string>
However RedisArray::keys should really be:
array<string, array<int, string>|false
which I verified locally (you'll receive false if no redis server is running, and the multidimensional array structure if everything is set up correctly).
The main question for me is how this should be solved in PHPStan. Options:
- fix only the Redis::keys definition to be broad enough (e.g. PhpStorm and Psalm stubs simply use
array|false|Redis)
- have separate, detailed definitions for Redis::keys and RedisArray::keys
Code snippet that reproduces the problem
No response
Expected output
- no issue if checking the result of RedisArray::keys for
false
- no issue if accessing the result of RedisArray::keys correctly (string key, array value)
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
I originally filed #9747 but that was closed automatically, and there's more to it than the fact that "false" is missing.
I'd like to focus this issue on the specific RedisArray::keys issue rather than the "false missing everywhere" issue.
Actually, RedisArray::keys returns a different array structure than Redis::keys.
Quoting from https://github.com/phpredis/phpredis/blob/develop/arrays.md#limitations:
Right now, PHPStan seems to reuse the Redis::keys definition for RedisArray::keys, which currently reads:
array<int,string>However RedisArray::keys should really be:
array<string, array<int, string>|falsewhich I verified locally (you'll receive false if no redis server is running, and the multidimensional array structure if everything is set up correctly).
The main question for me is how this should be solved in PHPStan. Options:
array|false|Redis)Code snippet that reproduces the problem
No response
Expected output
falseDid PHPStan help you today? Did it make you happy in any way?
No response