| 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: | */ |
| 26: | #[ExtensionInterface(tag: self::EXTENSION_TAG)] |
| 27: | interface ResultCacheMetaExtension |
| 28: | { |
| 29: | |
| 30: | public const EXTENSION_TAG = 'phpstan.resultCacheMetaExtension'; |
| 31: | |
| 32: | /** |
| 33: | * Returns unique key for this result cache meta entry. This describes the source of the metadata. |
| 34: | */ |
| 35: | public function getKey(): string; |
| 36: | |
| 37: | /** |
| 38: | * Returns hash of the result cache meta entry. This represents the current state of the additional meta source. |
| 39: | */ |
| 40: | public function getHash(): string; |
| 41: | |
| 42: | } |
| 43: |