Interface PHPStan\Analyser\ResultCache\ResultCacheValueExtension

A value outside of the analysed code that rules and extensions read - whether a service exists in a DI container, the value of a configuration parameter, the contents of a file.

A rule or an extension reading such a value declares it:

$scope->trackValueDependency(MyExtension::class, $key);

The result cache then records the value, and re-analyses the files that declared it when it is different, and only them. Compared to ResultCacheMetaExtension, which discards the whole result cache on any change, only what was actually asked about matters, and only for the files asking.

To register it in the configuration file use the phpstan.resultCacheValueExtension service tag:

services:
	-
		class: App\PHPStan\MyExtension
		tags:
			- phpstan.resultCacheValueExtension
  • PHPStan\Analyser\ResultCache\ResultCacheValueExtension
    • PHPStan\Type\Php\OpenSslCipherMethodsProvider implements ResultCacheValueExtension
    • PHPStan\Analyser\ResultCache\ClassResultCacheValueExtension implements ResultCacheValueExtension
    • PHPStan\Analyser\ResultCache\DirectoryResultCacheValueExtension implements ResultCacheValueExtension
    • PHPStan\Analyser\ResultCache\FileResultCacheValueExtension implements ResultCacheValueExtension
Methods