Replies: 1 comment
|
The part that Psalm supports directly is Current Psalm documents/tests explicitly support forms such as: /** @param key-of<self::DAYS> $day */and If you need exactly the keys under final class AdminAssets
{
public const JS = [
'foo-script' => ['src' => 'file.js'],
'bar-script' => ['src' => 'file.js'],
];
public const ASSETS = [
'js' => self::JS,
];
/** @param key-of<self::JS> $key */
public static function show(string $key): void
{
}
}Now Psalm can derive So |
Uh oh!
There was an error while loading. Please reload this page.
I have the following code
How can I declare that method
showcan accept string union fromASSETS['js']keys ('foo-script'|'bar-script')?I'm tired to use
@param key-of<ASSETS['js']> $keybut got error[InvalidDocblock](https://psalm.dev/008) - 18:15 - Unrecognised template param 'js' in docblock for AdminAssets::showAll reactions