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