Skip to content

Commit 67094e3

Browse files
Add test
1 parent 746caa6 commit 67094e3

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,14 @@ public function testBug11289(): void
11831183
$this->analyse([__DIR__ . '/data/bug-11289.php'], []);
11841184
}
11851185

1186+
public function testBug9120(): void
1187+
{
1188+
$this->checkThisOnly = false;
1189+
$this->checkUnionTypes = true;
1190+
$this->checkDynamicProperties = false;
1191+
$this->analyse([__DIR__ . '/data/bug-9120.php'], []);
1192+
}
1193+
11861194
public function testBug8668(): void
11871195
{
11881196
$this->checkThisOnly = false;
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 Bug9120;
4+
5+
function do_something(): void
6+
{
7+
$db = new \PDO('connection-string');
8+
9+
$statement = $db->query('sql-query');
10+
if ($statement !== false)
11+
{
12+
$statement->setFetchMode(\PDO::FETCH_OBJ);
13+
14+
foreach ($statement as $tmpObject)
15+
{
16+
echo $tmpObject->mycolumn;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)