You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ClassResultCacheValueExtension can run stub files extensions before bootstrapFiles #15375
When the result cache is restored, ClassResultCacheValueExtension::getValue() calls ClassReflection::getAncestors(). In some cases that initialises StubPhpDocProvider, which runs the registered StubFilesExtensions before bootstrapFiles have run.
A comment in ResultCacheManager::restore() says restoring must not run them, because they can rely on bootstrapFiles having been executed.
Is this OK, or should stub files extensions not rely on bootstrap files any more?
I noticed it because Larastan's stub files extension reads a constant that its bootstrap file defines.
Code snippet that reproduces the problem
No response
Expected output
Stub files extensions are not run before bootstrapFiles when the result cache is restored. Or, if running them there is intended, the comment says so.
Did PHPStan help you today? Did it make you happy in any way?
I feel like ClassResultCacheValueExtension shouldn't call ClassReflection::getAncestors(), it should have a more lightweight way to find out the parents that doesn't call StubPhpDocProvider at all.
Activity
mergeable commentedon Oct 4, 2026
This bug report is missing a link to reproduction at phpstan.org/try.
It will most likely be closed after manual review.
ondrejmirtes commentedon Oct 24, 2026
I feel like ClassResultCacheValueExtension shouldn't call ClassReflection::getAncestors(), it should have a more lightweight way to find out the parents that doesn't call StubPhpDocProvider at all.