Public method in Symfony application marked wrongly as unused by code inspection
Hi,
I find very useful the code inspection and I'm using it as a quick method to identify error before running the code or identify code portion to refactor.
I was not able to use the "Ununsed element" as many method in my controllers are marked as such, and I'm not able to identify why this happens.
For example, I have a controller with the metod "public function indexAction(Request $request)" that is NOT marked as unused, altough it is only referenced by route name in the HTML navbar (<a href="{{ path('index') }}">Items list</a>).
The other methods in the same controller are identified as "Unused element", but they are also referenced by route name in the same HTML navbar.
Please note that "Show usage" of methods return "No usages found" also for the first method, which is not marked as unused.
As I fhink this functionality is very useful during refactor, is there something that I am missing ?
Is there any particular configuration should I use ?
I'm using PhpStorm version 2019.3.
I have already tried to invalidate cache and restart, as I have read in other post, with no result.
Thanks in advance
Please sign in to leave a comment.
Hi there,
Please follow https://youtrack.jetbrains.com/issue/WI-47938 (may also check comments from other related/duplicate tickets to get bigger pic)
>For example, I have a controller with the metod "public function indexAction(Request $request)" that is NOT marked as unused, altough it is only referenced by route name in the HTML navbar (<a href="{{ path('index') }}">Items list</a>).
>The other methods in the same controller are identified as "Unused element", but they are also referenced by route name in the same HTML navbar.
Just an idea: "index" might be a special/excluded name as it's too common so hard to test properly (mainly for performance reasons). I remember seeing similar kind of explanation for some other method names.