-
Notifications
You must be signed in to change notification settings - Fork 547
Remember resolved types after pushInFunctionCall #4648
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
ondrejmirtes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Could be in popInFunctionCall too
- BUT:
$this->inFunctionCallsStackis used in resolveType() in} elseif ($node instanceof Expr\Closure || $node instanceof Expr\ArrowFunction) {so that could be a problem (the problem should be reproduced in a test first).
|
Issue bot points out an example where this breaks https://phpstan.org/r/dfc26675-234f-47b3-8d0f-dc64b66ef5aa |
I think this problem was caught by existing tests, as the suite failed with the change until I got it right. |
|
This pull request has been marked as ready for review. |
|
Perfect! Thank you. My idea for preserving This logic doesn't have to be called in methods like And the implementation of preserveResolvedTypes would look at changes between This logic is very similar to what Do you think you want to look into this? |
|
I can have a look |

prevents duplicate work, as MethodCalls will re-calculated one less time.
analysing
before this PR reaches “if ($node instanceof MethodCall) {“ in MutatingScope.php:2161 4 times.
after the PR only 3 times.
with
PHPSTAN_FNSR=1 php bin/phpstan analyze foo.php --debugafter PR its only 2 times.