Skip to content

Commit e4327da

Browse files
Add 11015 regression test
1 parent 5668c05 commit e4327da

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/PHPStan/Rules/PhpDoc/WrongVariableNameInVarTagRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ public function testBug12458(): void
197197
$this->analyse([__DIR__ . '/data/bug-12458.php'], []);
198198
}
199199

200+
public function testBug11015(): void
201+
{
202+
$this->checkTypeAgainstNativeType = true;
203+
$this->checkTypeAgainstPhpDocType = true;
204+
$this->strictWideningCheck = true;
205+
206+
$this->analyse([__DIR__ . '/data/bug-11015.php'], []);
207+
}
208+
200209
public function testEnums(): void
201210
{
202211
if (PHP_VERSION_ID < 80100) {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug11015;
4+
5+
class HelloWorld
6+
{
7+
public function sayHello(PDOStatement $date): void
8+
{
9+
$b = $date->fetch();
10+
if (empty($b)) {
11+
return;
12+
}
13+
14+
/** @var array<string, int> $b */
15+
echo $b['a'];
16+
}
17+
18+
public function sayHello2(PDOStatement $date): void
19+
{
20+
$b = $date->fetch();
21+
22+
/** @var array<string, int> $b */
23+
echo $b['a'];
24+
}
25+
}

0 commit comments

Comments
 (0)