-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
WIP: Update stubs so the tests pass in strict mode #2015
Conversation
@yatsukhnenko I will try to figure out what the actual setting is that causes the issues. Maybe it's if you're in a debug build... |
This PR could also fix #1921, as the stubs are correct now. |
@kkmuffme I can do that, although I'm not sure whether the modifications constitute breaking changes, meaning we can't release until >= PhpRedis 6.0. |
That's fine, the docs have been wrong all this time. |
Hey @michael-grunder , I'm one of the maintainers of Psalm. We're struggling a lot recently with the definitions of phpredis methods to have a correct idea of what the current signature are (see vimeo/psalm#7709 (comment)) Would you mind giving us a quick summary of where we could find an authoritative source for what's the current stable version of phpredis and how it's planned to evolve? We had old definitions until recently when we tried to use your stub here as source, but it seems to mismatch the current stable version. We're not sure if this PR is supposed to be a future version, a WIP or what. Please tell me if you prefer me to open an issue or a discussion about this, I'll be glad to :) Thanks! |
The most accurate prototype information is in the @yatsukhnenko Are you opposed to getting this merged for release in >= 6.0.0? |
Thanks! That's good to know! We have a feedback from a user who seem to show the Also, do you intend to add constants to this stub? We tend to add them in stubs on Psalm but this may not be the custom here |
@michael-grunder go ahead 🙂 |
Good catch, thanks. I'll update the branch.
The last time I checked, the |
We have another user who is surprised to see the Redis instance returned by some methods: vimeo/psalm#7709 (comment) (for example on exists). Is this expected behaviour? Maybe on some special conditions? |
Yes, that's one of the main fixes introduced in the branch. Nearly all methods can return the e.g. $redis->pipeline();
// These commands will both return the Redis object
$redis->set('foo', 'bar');
$redis->incr('counter');
// Returns an array with the result of the above two commands
$result = $redis->exec(); |
Oh thanks! That might need a special handling in Psalm if we want to be super precise! |
87e7040
to
77334ec
Compare
Dealing with this is going to be a PITA 🙁. Lot of user code assumes the methods like |
Agreed, it's breaking as hell which is why we can't officially release it until PhpRedis >= 6.0.0. Is there any way we can lessen the pain from this end? |
* fixes feedback for setOption of vimeo#7709 * latest WIP stubs with additional changes from upstream phpredis master and other additions From https://raw.githubusercontent.com/phpredis/phpredis/77334ecbf2c06ea1ff18ea5e3ecc168cb1897a8b/redis.stub.php via phpredis/phpredis#2015
Also the constants are missing in the stubs and the docs (@todo in https://github.com/phpredis/phpredis#predefined-constants) I just grepped them out of the code base:
|
btw the new stubs are amazing, not a PITA at all. In fact I could remove so many static analysis suppressions from the code base and fix a few issues that didn't come up with the last stubs. |
I think it should be changed, to only accept string types for set functions (set, mset,...) |
Also this issue should be taken care of #2120 (ideally in the docs too?) |
These changes allow the PHP 8 unit tests to pass even when zpp strict mode is enabled. I'm not exactly sure which setting causes the issue, but without these changes I get many `zpp` errors if I run the tests inside of a PHP build tree.
77334ec
to
bdf201f
Compare
@yatsukhnenko I think maybe we merge it in preparation for PhpRedis 6.0.0? We should also both go over the codebase and find any other things we'd like to break 😈 |
@michael-grunder lets merge it |
These changes allow the PHP 8 unit tests to pass even when zpp strict
mode is enabled.
I'm not exactly sure which setting causes the issue, but without these
changes I get many
zpp
errors if I run the tests inside of a PHP buildtree.
Fixes #2051, #2096, #1921