@@ -244,11 +244,69 @@ public function testObjects2(array $array): void
244244final class Foo
245245{
246246
247+ public int $ publicProperty ;
248+ protected int $ protectedProperty ;
249+ private int $ privateProperty ;
250+
251+ /** @param array<int, self> $a */
252+ public function doFoo (array $ a ): void
253+ {
254+ assertType ('array{} ' , array_column ($ a , 'nodeName ' ));
255+ assertType ('array{} ' , array_column ($ a , 'nodeName ' , 'tagName ' ));
256+ assertType ('list<int> ' , array_column ($ a , 'publicProperty ' ));
257+ assertType ('array{} ' , array_column ($ a , 'protectedProperty ' ));
258+ assertType ('array{} ' , array_column ($ a , 'privateProperty ' ));
259+ }
260+
261+ }
262+
263+
264+ class FooNotFinal
265+ {
266+
267+ public int $ publicProperty ;
268+ protected int $ protectedProperty ;
269+ private int $ privateProperty ;
270+
271+ /** @param array<int, self> $a */
272+ public function doFoo (array $ a ): void
273+ {
274+ assertType ('list ' , array_column ($ a , 'nodeName ' ));
275+ assertType ('array ' , array_column ($ a , 'nodeName ' , 'tagName ' ));
276+ assertType ('list<int> ' , array_column ($ a , 'publicProperty ' ));
277+ assertType ('list ' , array_column ($ a , 'protectedProperty ' ));
278+ assertType ('list ' , array_column ($ a , 'privateProperty ' ));
279+ }
280+
281+ }
282+
283+
284+ final class Magic
285+ {
286+
287+ public int $ publicProperty ;
288+ protected int $ protectedProperty ;
289+ private int $ privateProperty ;
290+
291+ public function __get ($ prop )
292+ {
293+ return $ this ->$ prop ;
294+ }
295+
296+ public function __isset ($ prop ) : bool
297+ {
298+ return isset ($ this ->$ prop );
299+ }
300+
247301 /** @param array<int, self> $a */
248302 public function doFoo (array $ a ): void
249303 {
250304 assertType ('list ' , array_column ($ a , 'nodeName ' ));
251305 assertType ('array ' , array_column ($ a , 'nodeName ' , 'tagName ' ));
306+ assertType ('list<int> ' , array_column ($ a , 'publicProperty ' ));
307+ assertType ('list ' , array_column ($ a , 'protectedProperty ' ));
308+ assertType ('list ' , array_column ($ a , 'privateProperty ' ));
252309 }
253310
254311}
312+
0 commit comments