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
/** * @template T as int|string * * @param array<T, mixed> $arr * @return array<int, T> */ function my_array_keys($arr) { return array_keys($arr); } $a = my_array_keys(["hello" => 5, "goodbye" => new \Exception()]);
https://phpstan.org/r/b92e2661-21cd-4182-b987-312171de77fd
No issues
Function my_array_keys() should return array<int, T> but returns array<int, (int|string)>.
The text was updated successfully, but these errors were encountered:
The weirdest thing here is tha @template T as int|string isn't reported as unsupported, which it should be: https://phpstan.org/r/c4869d53-2241-455f-a705-5ab447090799
@template T as int|string
Sorry, something went wrong.
It's because of as instead of of: https://phpstan.org/r/6b4f0a22-a01d-435a-9875-2e786cbe6b7c
as
of
Error without bound: https://phpstan.org/r/bf701ed3-fcc5-481d-acb6-8c86db431039
phpstan/phpstan-src@3c43c54
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
Bug report
https://phpstan.org/r/b92e2661-21cd-4182-b987-312171de77fd
Expected output
No issues
Actual
Function my_array_keys() should return array<int, T> but returns array<int, (int|string)>.
The text was updated successfully, but these errors were encountered: