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

Method demo

examples/demo.php:2599–2613  ·  view source on GitHub ↗
(User $user)

Source from the content-addressed store, hash-verified

2597class ScalarMemberAccessDemo
2598{
2599 public function demo(User $user): void
2600 {
2601 // getName() returns string — accessing a method on it is an error:
2602 $user->getName()->trim();
2603
2604 // getEmail() returns string — property access is also an error:
2605 $user->getEmail()->length;
2606
2607 // Chains through intermediate classes work too:
2608 $user->getProfile()->getDisplayName()->toUpper();
2609
2610 // Works with Response too — isSuccess() returns bool:
2611 $resp = new Response(200, 'OK');
2612 $resp->isSuccess()->flag;
2613 }
2614}
2615
2616

Callers

nothing calls this directly

Calls 5

getEmailMethod · 0.80
getDisplayNameMethod · 0.80
isSuccessMethod · 0.80
getNameMethod · 0.45
getProfileMethod · 0.45

Tested by

no test coverage detected