1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Analyser\ResultCache;
4:
5: use PHPStan\DependencyInjection\ExtensionInterface;
6:
7: /**
8: * ResultCacheMetaExtension can be used for extending PHPStan's built-in mechanism that is used for
9: * calculating metadata for result cache. Using this extension you may add additional metadata that will
10: * be used for determining if analysis must be run again, or can be re-used from result cache.
11: *
12: * @see https://github.com/phpstan/phpstan-symfony/issues/255 for the context.
13: *
14: * To register it in the configuration file use the `phpstan.resultCacheMetaExtension` service tag:
15: *
16: * ```
17: * services:
18: * -
19: * class: App\PHPStan\MyExtension
20: * tags:
21: * - phpstan.resultCacheMetaExtension
22: * ```
23: *
24: * @api
25: * @deprecated Use value tracking or file tracking instead. See:
26: * https://phpstan.org/developing-extensions/result-cache-meta-extensions#tracking-dependencies-on-values
27: * https://phpstan.org/developing-extensions/result-cache-meta-extensions#tracking-dependencies-on-files
28: */
29: #[ExtensionInterface(tag: self::EXTENSION_TAG)]
30: interface ResultCacheMetaExtension
31: {
32:
33: public const EXTENSION_TAG = 'phpstan.resultCacheMetaExtension';
34:
35: /**
36: * Returns unique key for this result cache meta entry. This describes the source of the metadata.
37: */
38: public function getKey(): string;
39:
40: /**
41: * Returns hash of the result cache meta entry. This represents the current state of the additional meta source.
42: */
43: public function getHash(): string;
44:
45: }
46: