protected_to_private.rst 552 B

1234567891011121314151617181920212223242526272829303132333435
  1. =============================
  2. Rule ``protected_to_private``
  3. =============================
  4. Converts ``protected`` variables and methods to ``private`` where possible.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. final class Sample
  14. {
  15. - protected $a;
  16. + private $a;
  17. - protected function test()
  18. + private function test()
  19. {
  20. }
  21. }
  22. Rule sets
  23. ---------
  24. The rule is part of the following rule set:
  25. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_