magic_method_casing.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ============================
  2. Rule ``magic_method_casing``
  3. ============================
  4. Magic method definitions and calls must be using the correct casing.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. class Foo
  14. {
  15. - public function __Sleep()
  16. + public function __sleep()
  17. {
  18. }
  19. }
  20. Example #2
  21. ~~~~~~~~~~
  22. .. code-block:: diff
  23. --- Original
  24. +++ New
  25. <?php
  26. -$foo->__INVOKE(1);
  27. +$foo->__invoke(1);
  28. Rule sets
  29. ---------
  30. The rule is part of the following rule sets:
  31. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  32. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  33. References
  34. ----------
  35. - Fixer class: `PhpCsFixer\\Fixer\\Casing\\MagicMethodCasingFixer <./../../../src/Fixer/Casing/MagicMethodCasingFixer.php>`_
  36. - Test class: `PhpCsFixer\\Tests\\Fixer\\Casing\\MagicMethodCasingFixerTest <./../../../tests/Fixer/Casing/MagicMethodCasingFixerTest.php>`_
  37. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.