-
Notifications
You must be signed in to change notification settings - Fork 428
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
Fix Redis::keys function signature #2706
Fix Redis::keys function signature #2706
Conversation
|
👍 will go through all the |
I've gone through all |
Hello, thank you for this effort, the tests are failing.
Which methods did you remove and when they were removed from the extension? |
Could you point me in the correct direction as to why they might be failing? The error only says that one of the array keys for the parameters seems to be an integer but as far as I can see they are all strings:
|
If you named a parameter like You should be able to debug this by running the test and print what it's currently running around that line. |
Found the cause of the error by var_dumping while running the tests locally. It was due to one of the parameters missing the parameter name. |
Please return the removed functions back to the file, someone might be still using them. |
@ondrejmirtes added them back into the map 👍 Is there any guide on when to delete removed functions? |
There isn't. Basically there is never a good reason to remove functions that might still be in use. |
resources/functionMap.php
Outdated
'Redis::bitOp' => ['int', 'operation'=>'string', '...args'=>'string'], | ||
'Redis::bitpos' => ['int', 'key'=>'string', 'bit'=>'int', 'start='=>'int', 'end='=>'int'], | ||
'Redis::blPop' => ['array', 'keys'=>'string[]', 'timeout'=>'int'], | ||
'Redis::__construct' => ['void', 'options'=>'?array{host?:string,port?:int,connectTimeout?:float,auth?:list{string|null|false,string}|list{string},ssl?:array<string, mixed>,backoff?:array<string, mixed>}'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options
parameter should be optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 done
Thank you! You might also be interested in cleaning this up in https://github.com/JetBrains/phpstorm-stubs/tree/master/redis :) |
Probably after this PR there is issue 4th parameter is optional |
@RobiNN1 Please open a bug report. |
This PR fixes the
Redis::keys
function signature to match the stub provided by the Redis extension: https://github.com/phpredis/phpredis/blob/a0c8fcc589bfcf8207ba3d8c7d065109f31cc1c6/redis.stub.php#L1948-L1949Currently the functionMap says it can only return an
array<int,string>
but it can also return an instance ofRedis
when multimode is used orfalse
when no server is reachable.