File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
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
+ };
You can’t perform that action at this time.
0 commit comments