clean_namespace.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ========================
  2. Rule ``clean_namespace``
  3. ========================
  4. Namespace must not contain spacing, comments or PHPDoc.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. -namespace Foo \ Bar;
  14. +namespace Foo\Bar;
  15. Example #2
  16. ~~~~~~~~~~
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. -echo foo /* comment */ \ bar();
  22. +echo foo\bar();
  23. Rule sets
  24. ---------
  25. The rule is part of the following rule sets:
  26. - `@PHP80Migration <./../../ruleSets/PHP80Migration.rst>`_
  27. - `@PHP81Migration <./../../ruleSets/PHP81Migration.rst>`_
  28. - `@PHP82Migration <./../../ruleSets/PHP82Migration.rst>`_
  29. - `@PHP83Migration <./../../ruleSets/PHP83Migration.rst>`_
  30. - `@PHP84Migration <./../../ruleSets/PHP84Migration.rst>`_
  31. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  32. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  33. References
  34. ----------
  35. - Fixer class: `PhpCsFixer\\Fixer\\NamespaceNotation\\CleanNamespaceFixer <./../../../src/Fixer/NamespaceNotation/CleanNamespaceFixer.php>`_
  36. - Test class: `PhpCsFixer\\Tests\\Fixer\\NamespaceNotation\\CleanNamespaceFixerTest <./../../../tests/Fixer/NamespaceNotation/CleanNamespaceFixerTest.php>`_
  37. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.