-
Notifications
You must be signed in to change notification settings - Fork 471
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
Introduce Scope::getMaybeDefinedVariables #3521
Conversation
You've opened the pull request against the latest branch 2.0.x. PHPStan 2.0 is not going to be released for months. If your code is relevant on 1.12.x and you want it to be released sooner, please rebase your pull request and change its target to 1.12.x. |
46fdb83
to
c2195b8
Compare
Every time 🙈 |
I think a test could fit in https://github.com/phpstan/phpstan-src/blob/1.12.x/tests/PHPStan/Analyser/ScopeTest.php |
By doing this, when you are inside MutatingScope you can press "Go to test" in PHPStorm and it navigates you right to this test.
@staabm Thanks. Somehow I could not find it when using The tests are added. @ondrejmirtes This is ready for review! |
Thank you! |
@@ -574,6 +574,27 @@ public function getDefinedVariables(): array | |||
return $variables; | |||
} | |||
|
|||
/** | |||
* @api | |||
* @return array<int, string> |
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.
why not list<string>
?
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.
Copied from getDefinedVars
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.
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.
Great 🎉
Fixes phpstan/phpstan#11772
Where would be the best way to create a test for this?