-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
It would be great if generics supported binding scalars. Here's a use case:
/**
* @template K of array-key
* @param array<K, int> $in
* @return array<K, string>
*/
function stringValues(array $in): array {
return array_map(fn (int $int): string => (string) $int, $in);
}Currently, this gives me a
PHPDoc tag @template K for function stringValues() with bound type (int|string) is not supported.
See https://phpstan.org/r/f80b7892-415f-4c38-a63b-37b885d1b6ae
I have read somewhere that this is being considered, but I couldn't find an issue for it and I wanted to provide a use case.
Reactions are currently unavailable