Skip to content

Conversation

canvural
Copy link
Contributor

Hello 👋🏽

This PR caches the result of the ClassReflection::hasMethod method. While investigating some performance issues I found that PHPStan calls method class reflection extensions multiple times for the same class and method. And some extensions might do the actual work in hasMethod method rather than getMethod, for example Larastan does this to cache stuff internally.

I can add tests if wanted. Couldn't think of an easy way to do it right away 😅

@canvural canvural changed the base branch from 2.1.x to 1.12.x February 13, 2025 13:40
@canvural canvural changed the base branch from 1.12.x to 2.1.x February 13, 2025 13:40
@canvural canvural changed the base branch from 2.1.x to 1.12.x February 13, 2025 13:48
@ondrejmirtes ondrejmirtes merged commit fde29a5 into phpstan:1.12.x Feb 13, 2025
111 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@canvural canvural deleted the has-method-cache branch February 13, 2025 13:50
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