Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to detect/remove unused `use` statements from PHP codebase

Tags:

php

I've searched all over for something like this but I believe the word "use" is perhaps too common for any helpful results:

What is the easiest way to remove all un-used use statements from class files in a PHP codebase?

Edit: For the sake of simplicity, we can ignore detecting use statements that are used for annotations.

like image 636
leek Avatar asked Mar 27 '12 18:03

leek


1 Answers

Check FriendsOfPHP's PHP-CS-Fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer

like image 198
wdev Avatar answered Oct 05 '22 22:10

wdev