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

Method demo

examples/demo.php:1134–1145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1132class ClassStringVarDemo
1133{
1134 public function demo(): void
1135 {
1136 // new $var where $var holds a class-string
1137 $cls = Pen::class;
1138 $pen = new $cls;
1139 $pen->write(); // resolves Pen from class-string
1140
1141 // $var::staticMethod() where $var holds a class-string
1142 $userClass = User::class;
1143 $found = $userClass::findByEmail('test@example.com');
1144 $found->getEmail(); // resolves User from class-string static call
1145 }
1146}
1147
1148

Callers

nothing calls this directly

Calls 3

writeMethod · 0.80
findByEmailMethod · 0.80
getEmailMethod · 0.80

Tested by

no test coverage detected