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
add failing test from https://github.com/phpstan/phpstan/issues/8467 #2061
Conversation
@ondrejmirtes |
Yeah, I probably didn't explain myself clearly. The situation in Composer sources is complicated. I came up with a simple example. I also thought it'd pass on 1.9.2 but it doesn't. But if we fix it, it's gonna fix the problem in Composer too I think. Because you made conditional types smarter, this situation is now happening in more places. I hope this reasoning is more clear than before 😊 |
I see. Thanks, I understand. |
aa2c4e9
to
4077165
Compare
My theory is that we might need to disable this 35db779 for |
This is one idea to solve the current problem. |
You need "maybe" so that people can ask about it with "no" would not be precise, because that's not how PHP works. Even with the stricter setting ( |
Fair enough. I'll look for another solution. |
…ch key and value" This reverts commit 4077165.
Sorry, I read this comment now. Yeah, I think so too. |
96fc9c8
to
93b2a8a
Compare
…uteScopeWithAlwaysIterableForeach: false
93b2a8a
to
63ed3a5
Compare
For the rector test case rest of the errors are from PocketMine is wired, I'm not sure why it wasn't an error before this change. |
I've realized there's a problem. I think it'd be a nice idea to have a new TypeInferenceTestCase subclass, and set That way we can test it fully and not just through DefinedVariableRuleTest. Because even with // $a is array
foreach ($a as $v) {
// $a is non-empty-array
} But where the problem is lies (and what might be hard to fix) is that the conditional types shouldn't create the connection (if The current solution might be fine if we don't come up with anything better, but let's try :) The problem in PocketMine-MP was already ignored, but with a different message probably (non-empty-array). |
I've just had breakfast and changed my mind - I want to try this in practice :) Feel free to mark this current changeset as ready, I'm gonna merge it, and if you come up with any ideas how to improve it, we can try it out, but I think the current state is okay to try out :) |
This was a good news, the only concern for me was this test change. |
This pull request has been marked as ready for review. |
Thank you :) |
I'll add this to TODOs |
phpstan/phpstan#8467