()
| 1283 | class ShapeMethodDemo |
| 1284 | { |
| 1285 | public function demo(): void |
| 1286 | { |
| 1287 | $data = $this->getToolKit(); |
| 1288 | $data['pen']->write(); // Pen |
| 1289 | $data['pencil']->sketch(); // Pencil |
| 1290 | |
| 1291 | // Nested annotated shape |
| 1292 | /** @var array{meta: array{page: int, total: int}, items: list<Pen>} $response */ |
| 1293 | $response = getUnknownValue(); |
| 1294 | $response['meta']['page']; // nested shape key |
| 1295 | $response['items'][0]->write(); // list element type |
| 1296 | |
| 1297 | // Nested keys inferred from literal — no annotation needed |
| 1298 | $config = ['db' => ['host' => 'localhost', 'port' => 3306], 'debug' => true]; |
| 1299 | $config['db']['host']; // Try: delete 'host' and trigger completion |
| 1300 | |
| 1301 | // Object shapes |
| 1302 | $profile = $this->getProfile(); |
| 1303 | $profile->name; // Ctrl+Click → jumps to `name:` in @return docblock |
| 1304 | |
| 1305 | $result = $this->getResult(); |
| 1306 | $result->tool->write(); // Ctrl+Click `tool` → jumps to `tool:` in @return docblock |
| 1307 | $result->meta->page; // Ctrl+Click `meta` → jumps to `meta:` in @return docblock |
| 1308 | } |
| 1309 | |
| 1310 | /** @return array{pen: Pen, pencil: Pencil, active: bool} */ |
| 1311 | public function getToolKit(): array { return []; } |
nothing calls this directly
no test coverage detected