no_unused_imports.rst 618 B

123456789101112131415161718192021222324252627282930313233
  1. ==========================
  2. Rule ``no_unused_imports``
  3. ==========================
  4. Unused ``use`` statements must be removed.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. @@ -1,5 +1,4 @@
  13. <?php
  14. use \DateTime;
  15. -use \Exception;
  16. new DateTime();
  17. Rule sets
  18. ---------
  19. The rule is part of the following rule sets:
  20. @PhpCsFixer
  21. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``no_unused_imports`` rule.
  22. @Symfony
  23. Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``no_unused_imports`` rule.