Open
Description
PHPStorm 2019.2 has a new inspection reporting unused code. But this marks a bunch of Symfony-specific cases as unused while they are not (well, some of them are more about related packages and may belong to a separate plugin, but I'm still listing them here):
- controller methods should be marked as used when a route is defined for them
- commands should be marked as used when they are registered as commands in the container (as they are registered in the CLI)
- event listeners should be marked as used:
- for event subscribers, the listener methods should be marked as used based on
getSubscribedEvents
- services tagged as
kernel.event_listener
should mark the listener methods as used too
- for event subscribers, the listener methods should be marked as used based on
- twig extension methods should be marked as used when they are references by registered functions/filters/tests (even better would be to check for usages of the function/filter/test in templates instead, but that may be too much)
- doctrine repositories should be marked as used when they are referenced as repository in the mapping of an entity
- constraint validators should be marked as used by their associated constraint
- validation constraint should be marked as used when they are used in some mapping file (XML or YAML) or as annotation (this case should be handled in a generic way by the annotations plugin instead).
- voters should be marked as used when they are registered as voters in the container
the list probably continues with other kind of services being tagged as hooks in other services btw.
note: I will keep updating the list if I think about more things.