Skip to content

NodeScopeResolver: Move assignByReference logic out of generic path#4711

Merged
ondrejmirtes merged 1 commit intophpstan:2.1.xfrom
staabm:nsr2
Jan 4, 2026
Merged

NodeScopeResolver: Move assignByReference logic out of generic path#4711
ondrejmirtes merged 1 commit intophpstan:2.1.xfrom
staabm:nsr2

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jan 4, 2026

this logic was executed for every expression, while we only need when !$argValue instanceof Variable || $argValue->name !== 'this'.

processArgs consumes 17% of overall runtime. lets try to not do unnecessary stuff again and again

@@ -5754,7 +5754,6 @@ private function processArgs(

if (isset($parameters) && $parametersAcceptor !== null) {
foreach ($args as $i => $arg) {
Copy link
Contributor Author

@staabm staabm Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not yet understand why we iterate all args twice inside of processArgs(), but if possible, I guess we could save quite some time in case we could it do just once

@ondrejmirtes ondrejmirtes merged commit bab0aa6 into phpstan:2.1.x Jan 4, 2026
636 of 645 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the nsr2 branch January 4, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants