Skip to content

Commit 4f2c1e1

Browse files
committed
Fix RedisCluster::multi() return type
1 parent e0c4844 commit 4f2c1e1

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8896,7 +8896,7 @@
88968896
'RedisCluster::mget' => ['array', 'array'=>'array'],
88978897
'RedisCluster::mset' => ['bool', 'array'=>'array'],
88988898
'RedisCluster::msetnx' => ['int', 'array'=>'array'],
8899-
'RedisCluster::multi' => ['Redis', 'mode='=>'int'],
8899+
'RedisCluster::multi' => ['RedisCluster|bool', 'mode='=>'int'],
89008900
'RedisCluster::object' => ['string', 'string='=>'string', 'key='=>'string'],
89018901
'RedisCluster::persist' => ['bool', 'key'=>'string'],
89028902
'RedisCluster::pExpire' => ['bool', 'key'=>'string', 'ttl'=>'int'],

tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,18 @@ public function testBug11179NoNamespace(): void
102102
]);
103103
}
104104

105+
public function testBug13392(): void
106+
{
107+
$this->analyse([__DIR__ . '/data/bug-13392.php'], [
108+
[
109+
'Dumped type: RedisCluster',
110+
15,
111+
],
112+
[
113+
'Dumped type: bool|RedisCluster',
114+
18,
115+
],
116+
]);
117+
}
118+
105119
}
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 Bug13392;
4+
5+
use RedisCluster;
6+
7+
interface Client
8+
{
9+
public function get(): RedisCluster;
10+
}
11+
12+
function func(Client $client): void
13+
{
14+
$redisCluster = $client->get();
15+
\PHPStan\dumpType($redisCluster);
16+
17+
$transaction = $redisCluster->multi();
18+
\PHPStan\dumpType($transaction);
19+
}

0 commit comments

Comments
 (0)