erichard / SublimePHPCompanion

A Sublime Text plugin that provides cool stuff for PHP 5.3+ coding session.
MIT License
932 stars 115 forks source link

Function to clean up unused "use" statements. #97

Closed mitchjam closed 7 years ago

mitchjam commented 7 years ago

I use the "find use" command constantly, however, when I have to remove something from the use block I have to search the whole file for references to that object. I would love a function that searches the current file for a reference to each class and removes any it doesn't find. There is similar functionality in PhpStorm.

PhpStorm: https://www.jetbrains.com/help/phpstorm/2017.1/optimizing-imports.html

erichard commented 7 years ago

So you want to remove unused use ? php-cs-fixer already do that, you can use it with the PHPCS plugin

mitchjam commented 7 years ago

I thought there must be something but for some reason when I looked I couldn't find a package to do it. Thanks.