Skip to content

Commit 3485922

Browse files
authored
Add false to Redis::mget() return type (#5831)
Co-authored-by: benconda <benoit.condaminet@yousign.com>
1 parent 8b906cf commit 3485922

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎resources/functionMap.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8696,7 +8696,7 @@
86968696
'Redis::lSet' => ['__benevolent<Redis|bool>', 'key'=>'string', 'index'=>'int', 'value'=>'mixed'],
86978697
'Redis::lSize' => ['', 'key'=>'string'],
86988698
'Redis::ltrim' => ['__benevolent<Redis|bool>', 'key'=>'string', 'start'=>'int', 'end'=>'int'],
8699-
'Redis::mget' => ['__benevolent<Redis|array<string, mixed>>', 'keys'=>'string[]'],
8699+
'Redis::mget' => ['__benevolent<Redis|array<string, mixed>|false>', 'keys'=>'string[]'],
87008700
'Redis::migrate' => ['__benevolent<Redis|bool>', 'host'=>'string', 'port'=>'int', 'key'=>'string|string[]', 'dstdb'=>'int', 'timeout'=>'int', 'copy='=>'bool', 'replace='=>'bool', 'credentials='=>'mixed'],
87018701
'Redis::move' => ['__benevolent<Redis|bool>', 'key'=>'string', 'index'=>'int'],
87028702
'Redis::mset' => ['__benevolent<Redis|bool>', 'key_values'=>'array<string, mixed>'],
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace RedisMget;
4+
5+
use Redis;
6+
7+
use function PHPStan\Testing\assertType;
8+
9+
function func(Redis $redis): void
10+
{
11+
$values = $redis->mget(['key1', 'key2']);
12+
assertType('(array<string, mixed>|Redis|false)', $values);
13+
14+
if ($values === false) {
15+
return;
16+
}
17+
18+
assertType('(array<string, mixed>|Redis)', $values);
19+
}

0 commit comments

Comments
 (0)