Skip to editor
Psalm
Docs
Playground
Plugins
Blog
Paid support
Share
Fix issues
Show original
PHP
Settings
<?php /** * @template T of array<string, mixed> */ final class Props { /** * @param T $props */ public function __construct(private array $props = []) { } /** * @template K of key-of<T> * @template TDefault * @param K $propKey * @param TDefault $default * @return T[K]|TDefault */ public function getProp(string $propKey, mixed $default = null): mixed { return $this->props[$propKey] ?? $default; } } /** @psalm-trace $data */ $data = (new Props(['title' => 'test', 'value' => 30]))->getProp('value', 0); print_r($data);
Issues
Types
idle
Saved Aug 13 2022 08:32 UTC
⌘/Ctrl+Enter
run
⌘/Ctrl+S
share
F8
/
⇧F8
next/prev issue