-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hi!
Thanks a lot for this great phpstan plugin, i was able to cleanup a lot of stuff in my repository.
I would like to be able to mark certain classes as not used, or skip marking certain classes as used, when certain conditions apply.
<?php
final readonly class MyDomainEvent {};
final readonly class MyDomainEvent2 {};
final readonly class MyDomainEventHandler()
{
public function __invoke(MyDomainEvent $event): void
{}
}
public function doSomething(): void
{
$this->raise(new MyDomainEvent()); // class is used inside the raise method call, and inside the invoke method call inside the event handler
$this->raise(new MyDomainEvent2()); // class is only used inside the raise method call
}Specifically, I want to mark domain events which are raised (through ->raise(...)) but not handled through an event handler, as unused. Or, i dont want to count the "raise" method as usage for any event class.
I tried overriding the getUsages for this but i dont have any luck so far. Since there is only the MemberUsageProvider interface, this was the only location i could think of to do this.
Question: is the above do-able with the current way things work with dead-code-detector?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request