Skip to content

Conversation

gaetan-petit
Copy link

@gaetan-petit gaetan-petit commented Jul 22, 2025

I think it should filter out methods with the AsMessageHandler attribute as they are reported as dead code while they're probably not.

@gaetan-petit
Copy link
Author

I'll add some tests if it's ok to you @janedbal

@gaetan-petit gaetan-petit force-pushed the patch-1 branch 2 times, most recently from aa22b8b to b6ee684 Compare July 23, 2025 15:42
@gaetan-petit gaetan-petit requested a review from janedbal July 23, 2025 15:47
{
$class = $method->getDeclaringClass();

return $this->hasAttribute($class, 'Symfony\Component\Messenger\Attribute\AsMessageHandler')
Copy link
Member

@janedbal janedbal Jul 24, 2025

Choose a reason for hiding this comment

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

I dont think this is correct. When used on class, I believe it only calls a single method (by default __invoke and optionally the one stated in the attribute)

Currently, you mark all methods as used in a class marked with this attribute.

We need test for such behaviour.

@gaetan-petit
Copy link
Author

I'm sorry I didn't update this PR, I'm in vacation, I'll do it later

@janedbal
Copy link
Member

janedbal commented Sep 1, 2025

This got implemented in #247

@janedbal janedbal closed this Sep 1, 2025
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