phpredis / phpredis

A PHP extension for Redis
Other
9.97k stars 2.14k forks source link

Mismatch in Redis method casing between documentation and stubs #2549

Open VincentLanglet opened 4 hours ago

VincentLanglet commented 4 hours ago

Expected/Actual behaviour

When using Static analysis tools (or PHPStorm) a wrong case in Redis methods are reported (example https://phpstan.org/r/de1a12bf-6371-4157-a464-915339d34829) but most of them are false positive.

For the record, PHPStorm stubs are copy-pasted from phpredis/phpredis stubbed ; and PHPStan use PHPStorm stubs.

Currently, there is a massive mismatch between the casing used in the documentation (like https://github.com/phpredis/phpredis#sismember) and the stub (like https://github.com/phpredis/phpredis/blob/b59e35a64f91e85b03b9f51bb41a393d1eac88d7/redis.stub.php#L3123)

sismember is an example, but I found the same issue on a loooot of methods from Redis which leads to 2 questions:

Starting here (https://github.com/phpredis/phpredis/blob/b59e35a64f91e85b03b9f51bb41a393d1eac88d7/redis.stub.php#L618C21-L618C33), there is:

I've checked

michael-grunder commented 2 hours ago

This is an issue that comes up from time to time.

What is the right casing to prefer ? (Ie is the doc or the sub right)

Function/method names in PHP are not case-sensitive so I don't have a preference.

Would it be possible to fix the doc/stub in order to be consistent ?

I'm not opposed to normalizing them. Primarily we need to ensure any changes cause as little pain as possible. Changing the casing shouldn't break any existing code, but might be a big pain for external stub maintainers.

Maybe we just lowercase all method names in the stubs and docs.