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
It appears if the type T has only one key, T[K] fails because K is just a string and perhaps it expects always a union type of strings/keys?
https://phpstan.org/r/f4197fdb-eaef-485c-a5be-d026adf5e6c2
No error
cc @rvanvelzen
The text was updated successfully, but these errors were encountered:
You're exactly right - this effectively becomes a constant string bound, which is not supported: https://phpstan.org/r/c28fe2e8-5201-4236-8f94-497fdf28f4c5
The trivial solution is to implement constant string/integer template bounds, given that key-of<T> can only be string or int.
key-of<T>
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.
Successfully merging a pull request may close this issue.
Bug report
Code snippet that reproduces the problem
It appears if the type T has only one key, T[K] fails because K is just a string and perhaps it expects always a union type of strings/keys?
https://phpstan.org/r/f4197fdb-eaef-485c-a5be-d026adf5e6c2
Expected output
No error
cc @rvanvelzen
The text was updated successfully, but these errors were encountered: