How to auto-invalidate cache when custom rule is updated? #4691
-
Hi, I have a custom rule registered in phpstan.neon.dist and we use phpstan cache
How can I prevent from false positives (getting 0 errors) after the rule is updated (can find more violations now)? We upload phpstan cache to GitLab CI cache so answering "just invalidate it manually" is not really feasible for me. I dont see any possibility to achieve this from what I see in the docs. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was waiting for the right idea to implement this :) And last night it came: phpstan/phpstan-src@1e53ab6 It will work automatically - if the source file of a registered extension is modified, the cache gets invalidated. It works even for referenced files, so for example if you have MethodClassReflectionExtension that instantiates a custom MethodReflection implementation, when the MethodReflection class is modified, cache gets invalidated as well. Please run the latest dev-master (be aware you can run into this issue #4715 but the analysis is fine otherwise) and check out the new If you want the cache invalidated when a file that's not in this list gets modified, you can add a simple constant with a name like |
Beta Was this translation helpful? Give feedback.
I was waiting for the right idea to implement this :) And last night it came: phpstan/phpstan-src@1e53ab6
It will work automatically - if the source file of a registered extension is modified, the cache gets invalidated. It works even for referenced files, so for example if you have MethodClassReflectionExtension that instantiates a custom MethodReflection implementation, when the MethodReflection class is modified, cache gets invalidated as well.
Please run the latest dev-master (be aware you can run into this issue #4715 but the analysis is fine otherwise) and check out the new
projectExtensionFiles
key in the saved result cache file - see if the list of files makes sense to you.If you…