Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php final class ArrayList { /** * @template A * @template B * * @param list<A> $list * @param callable(A): B $callback * @return list<B> */ public function map(array $list, callable $callback): array { throw new RuntimeException('never'); } } $result = (new ArrayList())->map([1, 2, 3], fn($i) => ['num' => $i]); /** @psalm-check-type $result = list<array{num: int}> */
Snippet created on April 21 2023 at 14:16 UTC
Settings
Get link