Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php /** * @psalm-suppress UnusedParam * @return ($mode is 1 ? array<int> : ($mode is 2 ? array<string> : array<object>)) */ function fetch(int $mode): mixed { return [1]; } $mode = rand(0,1) ? 1 : 2; $_r = fetch($mode); /** @psalm-trace $_r */; $_r = fetch(1); /** @psalm-trace $_r */; $_r = fetch(2); /** @psalm-trace $_r */; $_r = fetch(4); /** @psalm-trace $_r */;
Snippet created on July 27 2023 at 20:32 UTC
Settings
Get link