Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Dec 15, 2025

This PR is to avoid expensive calls when Closure/ArrowFunction is never used in function like arguments, with filter if no closure/arrowfunction in the args first.

@samsonasik samsonasik changed the title [NodeVisitor] Avoid reflection lookup when there is no Closure/ArrowFunction in Arg value [NodeVisitor] Avoid reflection lookup when there is no Closure/ArrowFunction in Arg value in ClosureWithVariadicParametersNodeVisitor Dec 15, 2025
@samsonasik
Copy link
Member Author

@TomasVotruba ready 👍

return null;
}

$methodReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($node);
Copy link
Member

Choose a reason for hiding this comment

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

The optimization should happen inside this method.

Otherwise the performance is reduced when it's called from different place.

Copy link
Member Author

Choose a reason for hiding this comment

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

The purpose of this PR is to avoid reflection lookup when possible on every call like, since the attribute flag filling is only when argument is closure/arrow function.

The method is general method that used in various places and imo already optimized.

@TomasVotruba
Copy link
Member

I'd prefer to keep original, as doing the same job and more readable.

@samsonasik samsonasik deleted the avoid-reflection-lookup branch December 15, 2025 09:30
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.

3 participants