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

Method demo

examples/demo.php:2277–2295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2275class UnsetDemo
2276{
2277 public function demo(): void
2278 {
2279 $pen = new Pen('blue');
2280 $pen->write(); // resolves to Pen
2281 unset($pen);
2282 // Try: $pen-> — no completions (variable was unset)
2283
2284 // Re-assigning after unset restores type
2285 $tool = new Pen('red');
2286 unset($tool);
2287 $tool = new Marker();
2288 $tool->highlight(); // resolves to Marker
2289
2290 // unset only affects targeted variable
2291 $pen2 = new Pen('green');
2292 $pencil = new Pencil();
2293 unset($pen2);
2294 $pencil->sketch(); // still resolves to Pencil
2295 }
2296}
2297
2298

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
highlightMethod · 0.80
sketchMethod · 0.80

Tested by

no test coverage detected