Skip to content

Remove Reflector from StubFilesExtensionLoader, replace with version checks#486

Open
xificurk wants to merge 1 commit intophpstan:2.0.xfrom
xificurk:stub-loader-without-reflection
Open

Remove Reflector from StubFilesExtensionLoader, replace with version checks#486
xificurk wants to merge 1 commit intophpstan:2.0.xfrom
xificurk:stub-loader-without-reflection

Conversation

@xificurk
Copy link
Copy Markdown

@xificurk xificurk commented May 7, 2026

The loader previously used BetterReflection's Reflector to check whether InputBag existed before loading its stubs. This triggered SourceLocator initialization (an expensive cache-populating operation) on every analysis run.

Replace the reflectClass() call with an isInstalledVersionBelow() version check (InputBag was introduced in symfony/http-foundation 5.1). Add a test that wires a ThrowingSourceLocator into the DI container's betterReflectionSourceLocator service, so any future regression that causes getFiles() to touch BetterReflection will fail the test explicitly.

--

Related:

…checks

The loader previously used BetterReflection's Reflector to check whether
InputBag existed before loading its stubs. This triggered SourceLocator
initialization (an expensive cache-populating operation) on every analysis run.

Replace the reflectClass() call with an isInstalledVersionBelow() version check
(InputBag was introduced in symfony/http-foundation 5.1). Add a test that wires
a ThrowingSourceLocator into the DI container's betterReflectionSourceLocator
service, so any future regression that causes getFiles() to touch BetterReflection
will fail the test explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@VincentLanglet
Copy link
Copy Markdown
Contributor

@VincentLanglet VincentLanglet requested a review from staabm May 7, 2026 21:24
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