Skip to content

Commit 933c2be

Browse files
committed
regression test
1 parent ee73a0b commit 933c2be

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Bug7844;
4+
5+
class C
6+
{
7+
/** @var float */
8+
public $val = .0;
9+
10+
/** @var array<float> */
11+
public $data = array();
12+
13+
public function foo(): void
14+
{
15+
\PHPStan\dumpType($this->data);
16+
if (count($this->data) > 0) {
17+
\PHPStan\dumpType($this->data);
18+
$this->val = array_shift($this->data);
19+
\PHPStan\dumpType($this->val);
20+
}
21+
}
22+
}
23+

tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ public function testBug13093b(): void
7474
$this->analyse([__DIR__ . '/data/bug-13093b.php'], []);
7575
}
7676

77+
public function testBug7844(): void
78+
{
79+
$this->analyse([__DIR__ . '/data/bug-7844.php'], []);
80+
}
81+
7782
}

0 commit comments

Comments
 (0)