Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Nov 26, 2025

the caching in

/** @var array<string, array{string, string[], string[], string[]}>|null $cached */
$cached = $this->cache->load($cacheKey, $variableCacheKey);
if ($cached !== null) {
foreach ($cached as $file => [$hash, $classes, $functions, $constants]) {
if (!array_key_exists($file, $fileHashes)) {
unset($cached[$file]);
continue;
}
$newHash = $fileHashes[$file];
unset($fileHashes[$file]);
if ($hash === $newHash) {
continue;
}
[$newClasses, $newFunctions, $newConstants] = $this->findSymbols($file);
$cached[$file] = [$newHash, $newClasses, $newFunctions, $newConstants];
}
} else {
$cached = [];
}

re-valides the cache contents via sha1_file() hashes. I think we can utilize this cache also for our test-suite.


running php tests/vendor/bin/paratest..

before this PR:

Time: 00:46.365, Memory: 636.50 MB

OK, but some tests were skipped!
Tests: 13381, Assertions: 80652, Skipped: 170.

after this PR:

...
Time: 00:41.428, Memory: 618.50 MB

OK, but some tests were skipped!
Tests: 13381, Assertions: 80652, Skipped: 170.
grafik

this will NOT solve phpstan/phpstan#13852 as it only affects the test-suite

@ondrejmirtes ondrejmirtes merged commit 63ee5de into phpstan:2.1.x Nov 26, 2025
610 of 638 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the cache2 branch November 26, 2025 18:51
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