Skip to content

Commit 3380dc5

Browse files
committed
Regression test
Closes phpstan/phpstan#9204
1 parent b042caa commit 3380dc5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug9204;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
function (): void {
8+
$goodObject = (new class() {
9+
/**
10+
* @var array<string, mixed>
11+
*/
12+
private array $properties;
13+
14+
/**
15+
* @param array<string, mixed> $properties
16+
*/
17+
public function __construct(array $properties = [])
18+
{
19+
$this->properties = $properties;
20+
}
21+
public function __isset(string $offset): bool
22+
{
23+
return isset($this->properties[$offset]);
24+
}
25+
public function __get(string $offset): mixed
26+
{
27+
return $this->properties[$offset] ?? null;
28+
}
29+
});
30+
$objects = [
31+
new $goodObject(['id' => 42]),
32+
new $goodObject(['id' => 1337]),
33+
];
34+
35+
$columns = array_column($objects, 'id');
36+
assertType('list', $columns);
37+
};

0 commit comments

Comments
 (0)