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

Method demo

examples/demo.php:2882–2894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2880class CollectGenericDemo
2881{
2882 public function demo(): void
2883 {
2884 /** @var Pen[] $pens */
2885 $pens = [];
2886
2887 // collect() uses function-level @template to carry element types
2888 // through to the returned FluentCollection.
2889 $collection = collect($pens);
2890 $collection->first()->write(); // TValue resolves to Pen
2891
2892 // Inline chaining works too
2893 collect($pens)->first()->write(); // same resolution, no intermediate variable
2894 }
2895}
2896
2897

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
collectFunction · 0.70
firstMethod · 0.45

Tested by

no test coverage detected