Mark code as used
See original GitHub issuePHPStorm 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_listenershould 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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:29
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How can you mark code as "not for future use" - Stack Overflow
I thought I explained the use case above, but I'll give it another try. We have a set of core libraries which are...
Read more >The Mark Text element - HTML: HyperText Markup Language
The <mark> HTML element represents text which is marked or highlighted for reference or notation purposes due to the marked passage's ...
Read more >What does the ? question mark mean in JavaScript code?
The question mark ? is an alternative to an if statement best used in the case where one of two values will be...
Read more >HTML mark Tag - W3Schools
Definition and Usage. The <mark> tag defines text that should be marked or highlighted.
Read more >Common HTML entities used for typography - W3C Wiki
This part of the Web Standards Curriculum looks at the different codes that can be used ... The pilcrow, used to mark the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

that would be an issue to me. Routes define public entry points to your site (at least GET routes for websites). Knowing whether these routes are used would involve scanning all external links pointing to your site too.
Thanks for this list, just for related issues there is also one on PhpStorm itself to provide an API for this: https://youtrack.jetbrains.com/issue/WI-47938
Maxim Kolmakov commented 2 Aug 2019 13:13