Let's say you have the following:
final readonly class SomeModel
{
public function __construct(
private string $name,
) {}
public function getName() : string
{
return $this->name;
}
}
And you return it inside a controller to a Twig template like this:
#[AsController]
final class SomeController extends AbstractController
{
#[Route(path: '/some', name: 'some')]
#[Template('some.html.twig')]
public function __invoke() : array
{
return [
'some' => new SomeModel('Ruud')
];
}
}
It will report that getName is unused. But it might be, we have no idea if it is used or not since it goes to Twig.
Would it be possible to do something similar to MemberUsageExcluder, but then for Inclusion?
I want all ClassMemberUsages that originate from a Controller Action, and go to a Template, marked as used.
Let's say you have the following:
And you return it inside a controller to a Twig template like this:
It will report that
getNameis unused. But it might be, we have no idea if it is used or not since it goes to Twig.Would it be possible to do something similar to MemberUsageExcluder, but then for Inclusion?
I want all ClassMemberUsages that originate from a Controller Action, and go to a Template, marked as used.