Skip to content

Cache PHPStorm stubs#4930

Open
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:cache-stubs
Open

Cache PHPStorm stubs#4930
staabm wants to merge 2 commits intophpstan:2.1.xfrom
staabm:cache-stubs

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Feb 14, 2026

refs phpstan/phpstan#14072 (comment)

requires ondrejmirtes/BetterReflection#40


with caching we see a ~5-6% perf improvement when result-cache is warmed. (single process with --debug)

grafik

I guess the caching is even more effective in parallel runs because it removes PHP-Parser::parse() of PHPStorm stubs on every worker-process creation.

Comment on lines +35 to +37
$stubsVersion = ComposerHelper::getPhpStormStubsVersion();
$cacheKey = sprintf('phpstorm-stubs-%s', $stubsVersion);
$variableCacheKey = sprintf('v1-%s-%s', ComposerHelper::getBetterReflectionVersion(), $this->phpVersion->getVersionString());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure whether this keys are correct this way.
whats the difference between $cacheKey and $variableCacheKey?

@staabm staabm requested a review from ondrejmirtes February 14, 2026 14:55
@staabm staabm marked this pull request as ready for review February 14, 2026 17:58
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

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