single_line_after_imports.rst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ==================================
  2. Rule ``single_line_after_imports``
  3. ==================================
  4. Each namespace use MUST go on its own line and there MUST be one blank line
  5. after the use statements block.
  6. Examples
  7. --------
  8. Example #1
  9. ~~~~~~~~~~
  10. .. code-block:: diff
  11. --- Original
  12. +++ New
  13. <?php
  14. namespace Foo;
  15. use Bar;
  16. use Baz;
  17. +
  18. final class Example
  19. {
  20. }
  21. Example #2
  22. ~~~~~~~~~~
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. <?php
  27. namespace Foo;
  28. use Bar;
  29. use Baz;
  30. -
  31. final class Example
  32. {
  33. }
  34. Rule sets
  35. ---------
  36. The rule is part of the following rule sets:
  37. - `@PER <./../../ruleSets/PER.rst>`_
  38. - `@PER-CS <./../../ruleSets/PER-CS.rst>`_
  39. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  40. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  41. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  42. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  43. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  44. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  45. References
  46. ----------
  47. - Fixer class: `PhpCsFixer\\Fixer\\Import\\SingleLineAfterImportsFixer <./../../../src/Fixer/Import/SingleLineAfterImportsFixer.php>`_
  48. - Test class: `PhpCsFixer\\Tests\\Fixer\\Import\\SingleLineAfterImportsFixerTest <./../../../tests/Fixer/Import/SingleLineAfterImportsFixerTest.php>`_
  49. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.