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.
Check FriendsOfPHP’s PHP-CS-Fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer