MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / demo

Method demo

examples/demo.php:2335–2352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2333class ArrayAccessDemo
2334{
2335 public function demo(): void
2336 {
2337 $src = new ScaffoldingArrayAccess();
2338
2339 $pens = $src->fetchAll(); // Pen[] from method return
2340 $pens[0]->write(); // resolves to Pen
2341
2342 $gifts = (new ScaffoldingGenericContext())
2343 ->display();
2344 $gifts[0]->open(); // resolves to Gift (element of Gift[])
2345
2346 $first = $pens[0];
2347 $first->color(); // resolves via $first = $pens[0]
2348
2349 // Inline method-return array access (no intermediate variable)
2350 $src->fetchAll()[0]->write(); // resolves Pen from Pen[] return type
2351 $src->fetchAll()[0]->color(); // same, different member
2352 }
2353}
2354
2355

Callers

nothing calls this directly

Calls 5

fetchAllMethod · 0.80
writeMethod · 0.80
displayMethod · 0.80
openMethod · 0.80
colorMethod · 0.80

Tested by

no test coverage detected