1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 22:01:48 +01:00

Allow int keys when calling Redis methods

In 5bfc0f960be71093c4b4dc754aa94c6142b44bd9, risky casting was invoked
as a way to show there is an issue here. However, it is not always
possible to use a string. For instance, there is no such thing as this
in PHP: ["1" => "whatever"]. If you try to create such an array, you
will obtain [1 => "whatever"] instead.

Ironically, this was copied in jetbrains/phpstorm, which is used in
PHPStan, which exhibited that false positive.

See https://github.com/JetBrains/phpstorm-stubs/pull/1454
This commit is contained in:
Grégoire Paris 2023-11-08 11:22:47 +01:00 committed by Grégoire Paris
parent 5f0798844e
commit ba17015dfb
No known key found for this signature in database
GPG Key ID: 24D48B8012B116BF

View File

@ -276,12 +276,12 @@ class Redis {
public function move(string $key, int $index): bool {} public function move(string $key, int $index): bool {}
/** /**
* @param array<string, string> * @param array<int|string, string>
*/ */
public function mset($key_values): Redis|bool {} public function mset($key_values): Redis|bool {}
/** /**
* @param array<string, string> * @param array<int|string, string>
*/ */
public function msetnx($key_values): Redis|bool {} public function msetnx($key_values): Redis|bool {}