You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
use more fine grained result-cache invalidation #1061
with 2.3.x arround the corner, we added some more fine grained mechanisms which allow your extension to tell phpstan while analysis which files depend on which other files. that way a more fine grained cache invalidation happens (and only in case something really changes).
in phpstan/phpstan-symfony@d9c130e you can see how phpstan-symfony was adapted to make use of this new extension type, which will be available as of 2.3.0.
Thanks for flagging this. We'll migrate in phpstan-drupal 2.3.0 and require phpstan/phpstan: ^2.3. Drupal core's main, 11.x, and 11.5.x branches already require ^2.3.4, so there's no reason to carry both APIs.
I'll post feedback on the API here as we work through it.
Feedback from migrating: getValue() runs in the main process before bootstrapFiles when the cache is restored. phpstan-drupal fills its service map in a bootstrap file, so:
Our ResultCacheMetaExtension hashed empty state on 2.3 and never invalidated.
Our first value extension returned a different value in workers than on restore, so every file re-analyzed on every run.
We fixed it by reading the site from disk without the bootstrap (#1071). Nothing failed or warned, so other extensions that populate state in a bootstrap file could hit the same thing. Could the docs and the ResultCacheValueExtension docblock mention that these methods can't rely on bootstrapFiles?
Activity
staabm commentedon Oct 1, 2026
note: apis have been renamed in phpstan/phpstan-src#6644
travis-bradbury commentedon Oct 22, 2026
ResultCacheMetaExtension is deprecated in 2.3.0 (https://github.com/phpstan/phpstan/releases/tag/2.3.0), which is affecting CI at the moment. E.g. https://github.com/mglaman/phpstan-drupal/actions/runs/39818848720/job/119964377570?pr=1063#step:6:14
Ignore ResultCacheMetaExtension deprecation in our own analysis (#1065)
mglaman commentedon Nov 5, 2026
Thanks for flagging this. We'll migrate in phpstan-drupal 2.3.0 and require
phpstan/phpstan: ^2.3. Drupal core'smain,11.x, and11.5.xbranches already require^2.3.4, so there's no reason to carry both APIs.I'll post feedback on the API here as we work through it.
mglaman commentedon Nov 5, 2026
Feedback from migrating:
getValue()runs in the main process beforebootstrapFileswhen the cache is restored. phpstan-drupal fills its service map in a bootstrap file, so:ResultCacheMetaExtensionhashed empty state on 2.3 and never invalidated.We fixed it by reading the site from disk without the bootstrap (#1071). Nothing failed or warned, so other extensions that populate state in a bootstrap file could hit the same thing. Could the docs and the
ResultCacheValueExtensiondocblock mention that these methods can't rely onbootstrapFiles?Track result cache dependencies instead of a site-wide hash (mglaman#…
staabm commentedon Nov 6, 2026
thanks for the feedback. Just opened
ResultCacheMetaExtension->getValue()is invoked before bootstrap-files are included phpstan/phpstan#15671ResultCacheMetaExtension->getValue()is invoked before bootstrap-files are included phpstan/phpstan-src#6964