Skip to content

Commit a3bc376

Browse files
committed
Allow int keys when calling methods
In 5bfc0f9, 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 JetBrains/phpstorm-stubs#1454
1 parent 5f07988 commit a3bc376

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stubs/extensions/redis.phpstub

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,20 @@ class Redis {
268268

269269
public function ltrim(string $key, int $start , int $end): Redis|bool {}
270270

271-
/** @return false|list<false|string>|Redis */
271+
/** @return false|list<false|int|string>|Redis */
272272
public function mget(array $keys) {}
273273

274274
public function migrate(string $host, int $port, string $key, string $dst, int $timeout, bool $copy = false, bool $replace = false): bool {}
275275

276276
public function move(string $key, int $index): bool {}
277277

278278
/**
279-
* @param array<string, string>
279+
* @param array<int|string, string>
280280
*/
281281
public function mset($key_values): Redis|bool {}
282282

283283
/**
284-
* @param array<string, string>
284+
* @param array<int|string, string>
285285
*/
286286
public function msetnx($key_values): Redis|bool {}
287287

0 commit comments

Comments
 (0)