Result Cache

PHPStan caches the result of the analysis so the subsequent runs are much faster. You should always analyse the whole project - the list of paths passed to the analyse command should be the same to take advantage of the result cache. If the list of paths differs from run to run, the cache is rebuilt from the ground up each time.

The result cache is saved at %tmpDir%/resultCache.php. Learn more about tmpDir configuration »

Result cache contents #

  • The last time a full analysis of the project was performed. The full analysis is performed at least every 7 days.
  • Analysis variables used to invalidate a stale cache. If any of these values change, full analysis is performed again.
  • Errors in the last run
  • Dependency tree of project files. If file A.php was modified since the last run, A.php and all the files calling or otherwise referencing all the symbols in A.php are analysed again.

Clearing the result cache #

To clear the current state of the result cache, for example if you’re developing custom extensions and the result cache is getting stale too often, you can run the clear-result-cache command. Learn more »

Result cache also gets disabled when running with --debug.

Edit this page on GitHub

© 2016–2024 Ondřej Mirtes