(User $user)
| 2597 | class 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 |
nothing calls this directly
no test coverage detected