Skip to content

Symfony: allow explicit containerXmlPaths configuration#325

Merged
janedbal merged 1 commit intoshipmonk-rnd:masterfrom
ruudk:config-containerXmlPath
Mar 25, 2026
Merged

Symfony: allow explicit containerXmlPaths configuration#325
janedbal merged 1 commit intoshipmonk-rnd:masterfrom
ruudk:config-containerXmlPath

Conversation

@ruudk
Copy link
Copy Markdown
Contributor

@ruudk ruudk commented Mar 25, 2026

When using phpstan-symfony, its SymfonyContainerResultCacheMetaExtension causes a full PHPStan rerun whenever any dependency changes. On large projects this is a significant slowdown.

This option allows configuring containerXmlPaths directly in dead-code-detector's config, decoupling it from phpstan-symfony's containerXmlPath parameter. This way, users can remove phpstan-symfony's container config to avoid the cache invalidation penalty while still getting accurate DIC-based dead code detection.

Accepts list<string> to support multiple environments.

See: phpstan/phpstan-symfony#455
See: phpstan/phpstan-symfony#421

@ruudk ruudk force-pushed the config-containerXmlPath branch from d703138 to ba51bb0 Compare March 25, 2026 10:56
@ruudk ruudk changed the title Symfony: allow explicit containerXmlPath configuration Symfony: allow explicit containerXmlPaths configuration Mar 25, 2026
@janedbal
Copy link
Copy Markdown
Member

Also, readme should state it, sth like:

- phpstan/phpstan-symfony with `containerXmlPath` must be used 
- or `shipmonkDeadCode.usageProviders.symfony.containerXmlPaths` must be configured

When using phpstan-symfony, its `SymfonyContainerResultCacheMetaExtension`
causes a full PHPStan rerun whenever any dependency changes. On large
projects this is a significant slowdown.

This option allows configuring `containerXmlPaths` directly in
dead-code-detector's config, decoupling it from phpstan-symfony's
`containerXmlPath` parameter. This way, users can remove phpstan-symfony's
container config to avoid the cache invalidation penalty while still
getting accurate DIC-based dead code detection.

Accepts `list<string>` to support multiple environments.

See: phpstan/phpstan-symfony#455
See: phpstan/phpstan-symfony#421
@ruudk ruudk force-pushed the config-containerXmlPath branch from ba51bb0 to 7bdb015 Compare March 25, 2026 10:58
@ruudk
Copy link
Copy Markdown
Contributor Author

ruudk commented Mar 25, 2026

@janedbal Thanks for the review. Applied your feedback.

@ruudk ruudk requested a review from janedbal March 25, 2026 11:00
@janedbal janedbal merged commit 93c5592 into shipmonk-rnd:master Mar 25, 2026
32 checks passed
@ruudk ruudk deleted the config-containerXmlPath branch March 25, 2026 11:20
@ruudk
Copy link
Copy Markdown
Contributor Author

ruudk commented Mar 25, 2026

Thanks for the fast merge ⚡ If possible, would you mind tagging it? 🙏

@janedbal
Copy link
Copy Markdown
Member

I'll probably call this package stable soon, so next will be 1.0.0 - better to think twice before commitment.

@ruudk
Copy link
Copy Markdown
Contributor Author

ruudk commented Mar 25, 2026

Would it be better for me to pin to dev-master then?

@janedbal
Copy link
Copy Markdown
Member

I expect tag max within a week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants