Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8896,7 +8896,7 @@
'RedisCluster::mget' => ['array', 'array'=>'array'],
'RedisCluster::mset' => ['bool', 'array'=>'array'],
'RedisCluster::msetnx' => ['int', 'array'=>'array'],
'RedisCluster::multi' => ['Redis', 'mode='=>'int'],
'RedisCluster::multi' => ['__benevolent<RedisCluster|bool>', 'mode='=>'int'],
'RedisCluster::object' => ['string', 'string='=>'string', 'key='=>'string'],
'RedisCluster::persist' => ['bool', 'key'=>'string'],
'RedisCluster::pExpire' => ['bool', 'key'=>'string', 'ttl'=>'int'],
Expand Down
14 changes: 14 additions & 0 deletions tests/PHPStan/Rules/Debug/DumpTypeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,18 @@ public function testBug11179NoNamespace(): void
]);
}

public function testBug13392(): void
{
$this->analyse([__DIR__ . '/data/bug-13392.php'], [
[
'Dumped type: RedisCluster',
15,
],
[
'Dumped type: (bool|RedisCluster)',
18,
],
]);
}

}
19 changes: 19 additions & 0 deletions tests/PHPStan/Rules/Debug/data/bug-13392.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php declare(strict_types = 1);

namespace Bug13392;

use RedisCluster;

interface Client
{
public function get(): RedisCluster;
}

function func(Client $client): void
{
$redisCluster = $client->get();
\PHPStan\dumpType($redisCluster);

$transaction = $redisCluster->multi();
\PHPStan\dumpType($transaction);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, use assertType function and put this under tests/PHPStan/Analyser/nsrt. That's the usual place for type inference tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed in ec5642d.

}
Loading