Forrest logo
back to the phpcbf tool

php:qa:cleanup:imports

How to remove unused imports in php files?
$ phpcbf --standard=PSR12 ${filename}
try on your machine

This command uses phpcbf, a tool provided by PHP_CodeSniffer, to automatically fix coding style issues in PHP files, including removing unused imports. PSR12 is a coding standard that enforces a consistent and readable coding style.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • how to remove unused imports in php files?
back to the phpcbf tool