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

Method demo

examples/demo.php:823–839  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

821class ArrayShapeDemo
822{
823 public function demo(): void
824 {
825 // Literal array shape — key completion and value types
826 $config = ['host' => 'localhost', 'port' => 3306, 'tool' => new Pen()];
827 $config['']; // Try: key completion: host, port, tool
828 $config['tool']->write(); // value type → Pen
829
830 // Annotated shape
831 /** @var array{first: Pen, second: Pencil} $pair */
832 $pair = getUnknownValue();
833 $pair['first']->write();
834 $pair['second']->sketch();
835
836 // Shape from function return type
837 $cfg = getAppConfig();
838 $cfg['logger']->write();
839 }
840}
841
842

Callers

nothing calls this directly

Calls 4

getUnknownValueFunction · 0.85
getAppConfigFunction · 0.85
writeMethod · 0.80
sketchMethod · 0.80

Tested by

no test coverage detected