Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find unused public and protected methods in PHPStorm

Tags:

phpstorm

PHPStorm has a handy unused private method inspection, which detects methods that are without doubt not used.

I would sometimes be interested to scan my project for unused public/protected methods as well. I'm aware that this is not an exact science, and that would report methods that might be used outside this project (in the case of a library, for example), but subject to a manual review, that would probably be very useful.

Is this currently possible with PHPStorm?

like image 514
BenMorel Avatar asked Jan 25 '13 19:01

BenMorel


People also ask

How to find unused code with PHPStorm?

It's possible in PHPStorm 7/8. Go to Code > Inspect Code and use a custom inspection profile. In the Inspections window, click on Add and unselect everything except PHP > Unused. That's only the unused private method I mention.

How do I see unused methods in IntelliJ?

In newer versions of IntelliJ it's under Code -> Analyze Code -> Run Inspection by Name. Show activity on this post.


1 Answers

It's not possible with PhpStorm 6. Here is a snapshot of the Project Settings (where you can set those options):

Project Settings

like image 161
Marcelo Avatar answered Sep 18 '22 15:09

Marcelo