Skip to content

SymfonyUsageProvider: support anonymous services#238

Merged
janedbal merged 2 commits intomasterfrom
jt-symfony-inline-services
Aug 4, 2025
Merged

SymfonyUsageProvider: support anonymous services#238
janedbal merged 2 commits intomasterfrom
jt-symfony-inline-services

Conversation

@JanTvrdik
Copy link
Copy Markdown
Member

@JanTvrdik JanTvrdik commented Aug 1, 2025

https://symfony.com/doc/current/service_container/alias_private.html#anonymous-services

The anonymous service might not have a class, but only factory. The factory callback should be marked as used.

@JanTvrdik JanTvrdik requested a review from janedbal August 1, 2025 12:03
Copy link
Copy Markdown
Member

@janedbal janedbal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please simulate that in tests/Rule/data/providers/symfony/services.xml and adjust related test.

- Add anonymous service test case in services.xml without class attribute
- Add factory method test for anonymous service resolution
- Verify that methods called through anonymous service factories are properly detected as used

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@janedbal janedbal merged commit c1763fb into master Aug 4, 2025
33 checks passed
@janedbal janedbal deleted the jt-symfony-inline-services branch August 4, 2025 07:37
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