()
| 821 | class 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 |
nothing calls this directly
no test coverage detected