Avoid doing work before its necessary in mutating scope.#2537
Avoid doing work before its necessary in mutating scope.#2537ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
Conversation
|
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
|
Thank you! |
|
@ondrejmirtes do you think it would be feasible to be able to detect this kind of thing with a custom phpstan rule? i've written custom rules for single nodes but this would need to check more than one node so i don't know if it's possible, or if it is how i would approach it as a simple minimum, the rule could be checking for something like "if a variable is assigned and not used before an exit point" |
|
Please see this: phpstan/phpstan#8192 But read my last comment too - I was able to solve a bug without CFG even when I thought I needed CFG for that 😊 Maybe it will give you some ideas. Also bear in mind that the called thing that we move lower needs to be pure/immutable otherwise moving the call might have unintended side effects. |
|
okay that gives me something to read and think about, thanks! great point about purity, luckily phpstan already knows about the concept |
|
making changes to |
|
I don't understand the question. What kind of changes to the NodeScopeResolver? |
Few instances of asking for information before it's really necessary