-
Notifications
You must be signed in to change notification settings - Fork 546
Find all constant/method types per class at once #4737
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
base: 2.1.x
Are you sure you want to change the base?
Conversation
…ols not applicable for the current php version
|
This pull request has been marked as ready for review. |
|
hmm maybe this caching should happen in |
|
No, I don't think so. Please wait until I look at the code. |
|
|
||
| /** @var array<string, array<string, Type|null>> */ | ||
| /** @var array<lowercase-string, array<lowercase-string, array{ClassMethod, string}>> */ | ||
| private array $stubbedMethodNodes = []; |
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.
I don't follow, what's the difference between methodNodes and stubbedMethodNodes?
I'm probably slower than usual, you know, Friday morning, heavy snowing outside etc. 😊
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.
I had the impression based on the previous implementation that we should only remember the requested types.
but it seems thats not the case. simplified it now
before this PR we read/ast-traversed every stub file only until we found the single symbol we were searching for.
after something was found, traversal stopped and we returned early.
this means we e.g. see the same file beeing read/php-parsed/ast-traversed from the filesystem multiple times, when e.g. multiple constants of the same class are unkown or a mix of constants and methods are unknown.
see a phpstan-doctrine example run:
after this PR we remember all contained symbols within a stub file on the first read/parse/ast-traversal.
when later requested we can easily lookup whether a stub for a given method or constant exists, without the need to read/parse the stub file over and overr again.