Use custom service in place of PHPStan's implementation #10641
-
I want to tinker with how PHPStan validates the result cache (i.e. ignore PHP version or PHP extensions). For this I found out that this part is managed via the following lines in the config: -
implement: PHPStan\Analyser\ResultCache\ResultCacheManagerFactory
arguments:
scanFileFinder: @fileFinderScan
cacheFilePath: %resultCachePath%
analysedPaths: %analysedPaths%
composerAutoloaderProjectPaths: %composerAutoloaderProjectPaths%
usedLevel: %usedLevel%
cliAutoloadFile: %cliAutoloadFile%
bootstrapFiles: %bootstrapFiles%
scanFiles: %scanFiles%
scanDirectories: %scanDirectories%
checkDependenciesOfProjectExtensionFiles: %resultCacheChecksProjectExtensionFilesDependencies% Is it possible to use either a custom factory or make that factory return a custom implementation of the ResultCacheManager? I tried:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not possible, because some things from PHPStan core are not meant to be overridable. Instead of overriding and doing your own implementation, you should open feature requests to enhance PHPStan core. But they need to make sense for the general PHPStan userbase. I don't think you really want to ignore a change in PHP version for the purpose of result cache as that will often lead to a stale cache. |
Beta Was this translation helpful? Give feedback.
It's not possible, because some things from PHPStan core are not meant to be overridable. Instead of overriding and doing your own implementation, you should open feature requests to enhance PHPStan core. But they need to make sense for the general PHPStan userbase.
I don't think you really want to ignore a change in PHP version for the purpose of result cache as that will often lead to a stale cache.