PHP extension for Visual Studio Code comes with tons of code actions and code diagnostics! One of them sorts and removes unused uses:
It's a handy automation making your code tidy, light, and clean. It takes into account doctrine documentary comments, attributes, trait adaptations, and all the other PHP code aspects.
It would be even better to remove unnecessary uses whenever saving the
.php file. Luckily, you don't need any other extension, it's all already supported by PHP extension and VS Code.
Just add the following to your VS Code
You can even scope it just for
[.php] files, configure it globally in the global
settings.json, or just for the current workspace (read more at VSCode Documentation - Settings.
For more code actions please see PHP extension Documentation.