php_unit_internal_class.rst 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ================================
  2. Rule ``php_unit_internal_class``
  3. ================================
  4. All PHPUnit test classes should be marked as internal.
  5. Configuration
  6. -------------
  7. ``types``
  8. ~~~~~~~~~
  9. What types of classes to mark as internal
  10. Allowed values: a subset of ``['normal', 'final', 'abstract']``
  11. Default value: ``['normal', 'final']``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. +/**
  22. + * @internal
  23. + */
  24. class MyTest extends TestCase {}
  25. Example #2
  26. ~~~~~~~~~~
  27. With configuration: ``['types' => ['final']]``.
  28. .. code-block:: diff
  29. --- Original
  30. +++ New
  31. <?php
  32. class MyTest extends TestCase {}
  33. +/**
  34. + * @internal
  35. + */
  36. final class FinalTest extends TestCase {}
  37. abstract class AbstractTest extends TestCase {}
  38. Rule sets
  39. ---------
  40. The rule is part of the following rule set:
  41. @PhpCsFixer
  42. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``php_unit_internal_class`` rule with the default config.