psr0.rst 968 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. =============
  2. Rule ``psr0``
  3. =============
  4. Classes must be in a path that matches their namespace, be at least one
  5. namespace deep and the class name should match the file name.
  6. .. warning:: Using this rule is risky.
  7. This fixer may change your class name, which will break the code that depends
  8. on the old name.
  9. Configuration
  10. -------------
  11. ``dir``
  12. ~~~~~~~
  13. The directory where the project code is placed.
  14. Allowed types: ``string``
  15. Default value: ``''``
  16. Examples
  17. --------
  18. Example #1
  19. ~~~~~~~~~~
  20. *Default* configuration.
  21. .. code-block:: diff
  22. --- Original
  23. +++ New
  24. @@ -1,3 +1,3 @@
  25. <?php
  26. namespace PhpCsFixer\FIXER\Basic;
  27. -class InvalidName {}
  28. +class Psr0Fixer {}
  29. Example #2
  30. ~~~~~~~~~~
  31. With configuration: ``['dir' => './src']``.
  32. .. code-block:: diff
  33. --- Original
  34. +++ New
  35. @@ -1,3 +1,3 @@
  36. <?php
  37. -namespace PhpCsFixer\FIXER\Basic;
  38. -class InvalidName {}
  39. +namespace PhpCsFixer\Fixer\Basic;
  40. +class Psr0Fixer {}