-
Couldn't load subscription status.
- Fork 544
verify constants via array_key_exists #636
New issue
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
Conversation
aaeda50 to e7e6ec6 Compare e7e6ec6 to f69fe84 Compare f69fe84 to 6098f94 Compare | @ondrejmirtes is there already a option to run multiple |
| @voku Hi, I don't think it's necessary to support multiple FunctionTypeSpecifyingExtension for the same function. Everything can be written in a single extension. |
| Please verify that this also fixes: https://phpstan.org/r/2561c442-f952-470d-a6a5-1bc7a74b99ad |
| Or probably doesn't have to, maybe it's a totally different issue. |
@ondrejmirtes I really tried it, but I failed. How can I combine different |
| @voku There's phpstan-src/src/Analyser/SpecifiedTypes.php Lines 103 to 104 in 7340657
|
6a19e68 to 2e5129a Compare
@ondrejmirtes Thanks for the hint. I tried it, but it's not working as expected for different parameters?! But I re-think about it and for a simple check for array-shapes, we do not need multiple specified types at all: If we have array-shapes, then we do not need to specify the $array anymore, and we can specify the value of $key of |
| @ondrejmirtes Do you have some extra tests in mind? |
4725a4a to cfc1d9a Compare d3e4852 to 18e1a40 Compare 18e1a40 to ed85cc6 Compare ddd20b4 to 95d480b Compare | @ondrejmirtes this week I had again a bug in my code, where this fix could prevent it. Can you maybe give feedback here, thanks. 😊 |
| I did not read through all comments, but I think we need to be careful that this doesn't become another |
| Yes, that's what I worry about here. ImpossibleCheckTypeHelper should get thinner over time, not thicker. |
| Maybe we can only use the "array_key_exists"-extension improvement? 🤔 |
| Hi, I'm cleaning up old and stale PRs. Please send a new PR if you're still interested, thanks. I haven't merged this because I don't particularly feel great about the changes here. |
issue: phpstan/phpstan#4174
I looked into
ArrayKeyExistsFunctionTypeSpecifyingExtension, but it seems like I didn't fully understand the logic of the specifying classes. In this case we want to specify parameter 1 or/and 2, can we currently do that?