We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I create a function that returns a closure.
/** * @template TKey of array-key * @template RKey of array-key * @template TValue * * @param callable(TKey):RKey $fn * * @return Closure(iterable<TKey,TValue>):Generator<RKey,TValue> */ function map_keys(callable $fn): Closure { return function(iterable $iterable) use ($fn): Generator { foreach($iterable as $key => $value) { $mapped_key = $fn($key); yield $mapped_key => $value; } }; }
Currently, the PHPStan reports an error:
Template type TValue of function map_keys() is not referenced in a parameter.
Open in playground.
I hope I can declare the TValue as a template of the returning closure, instead a template of the function map_keys.
TValue
map_keys
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #8964
Sorry, something went wrong.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
Feature request
I create a function that returns a closure.
Currently, the PHPStan reports an error:
Open in playground.
I hope I can declare the
TValue
as a template of the returning closure, instead a template of the functionmap_keys
.Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: