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
array_keys
array_keys would never return a key that is not already part of the (narrowed) key type.
a simple first fix (i suppose): just removing this check: https://github.com/phpstan/phpstan-src/blob/612ee600d58315b23506a8a148b0100597b7661b/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php#L30
While this might not fix all cases, it would certainly fix the cases of narrowed array-key types to int or string? (*)
int
string
(*) with the known caveat of the internal type conversion of integer strings, of course
https://phpstan.org/r/f43ddd65-69db-4d3e-acb4-9d2689e5f5b3
8: Dumped type: list<int> 11: Dumped type: list<int>
No response
The text was updated successfully, but these errors were encountered:
a simple first fix (i suppose): just removing this check
You could give it a try and see how the test suite results look like
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Bug report
array_keys
would never return a key that is not already part of the (narrowed) key type.a simple first fix (i suppose): just removing this check: https://github.com/phpstan/phpstan-src/blob/612ee600d58315b23506a8a148b0100597b7661b/src/Type/Php/ArrayKeysFunctionDynamicReturnTypeExtension.php#L30While this might not fix all cases, it would certainly fix the cases of narrowed array-key types toint
orstring
? (*)(*) with the known caveat of the internal type conversion of integer strings, of course
Code snippet that reproduces the problem
https://phpstan.org/r/f43ddd65-69db-4d3e-acb4-9d2689e5f5b3
Expected output
8: Dumped type: list<int>
11: Dumped type: list<int>
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: