ciricode <?php /** * @template T * @template R * @param callable(T):R $callable * @return array{first:T,last:R} */ function generic($callable) { } $b = generic( /** * @param string $a * @return (string|int)[] */ function ($a) { return []; } ); $c = $b['first']; // not resolve $d = $b['last']; // work correctly
JakubMisek ciricode thank you for the test case; Right, we don't substitute callable type arguments - yet. Will be implemented.
JakubMisek Implemented, this feature will be available in the next update/pre-release. Thanks for the suggestion!