Proposal: Add config option to disable DI definition change cache invalidation `invalidateResultCacheOnDiDefinitionChange`

Open
#455 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php, symfony
Domain
tooling

Research direction

Start by reading PR #421 and its discussion to understand how DI definition changes trigger result-cache invalidation. Define the behavior of the proposed invalidateResultCacheOnDiDefinitionChange option, then add the corresponding configuration coverage and documentation; done means the option reliably controls this invalidation without changing the default behavior.

Written by the indexing model from the issue text.

Description

Hi 👋 First of all, thank you for the great work on PHPStan and the Symfony extension!

We are working on integrating result cache in our project to speed up analysis times. However, we noticed that the cache is invalidated very frequently, which reduces its effectiveness in most of our development workflows.

After some investigation, we identified the source of this behavior to be the feature added in this PR

We completely understand the value of this feature, it ensures the cache is invalidated when DI definitions change, which is especially important for production builds or CI pipelines to guarantee correctness.

However, in our development setup, this behavior is too aggressive. The DI container in our Symfony app changes very frequently , and as a result, the cache is invalidated most of the time. This defeats the purpose of caching during active development.

We suggest introducing a new configuration option (which was once discussed in the original PR but never merged):

Dominant language
PHP
Stars
800
Forks
104
Avg merge
4m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-symfony

All issues in phpstan/phpstan-symfony

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.