lowercase_keywords.rst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ===========================
  2. Rule ``lowercase_keywords``
  3. ===========================
  4. PHP keywords MUST be in lower case.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. - FOREACH($a AS $B) {
  14. - TRY {
  15. - NEW $C($a, ISSET($B));
  16. - WHILE($B) {
  17. - INCLUDE "test.php";
  18. + foreach($a as $B) {
  19. + try {
  20. + new $C($a, isset($B));
  21. + while($B) {
  22. + include "test.php";
  23. }
  24. - } CATCH(\Exception $e) {
  25. - EXIT(1);
  26. + } catch(\Exception $e) {
  27. + exit(1);
  28. }
  29. }
  30. Rule sets
  31. ---------
  32. The rule is part of the following rule sets:
  33. - `@PER <./../../ruleSets/PER.rst>`_
  34. - `@PER-CS <./../../ruleSets/PER-CS.rst>`_
  35. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  36. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  37. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  38. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  39. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  40. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  41. References
  42. ----------
  43. - Fixer class: `PhpCsFixer\\Fixer\\Casing\\LowercaseKeywordsFixer <./../../../src/Fixer/Casing/LowercaseKeywordsFixer.php>`_
  44. - Test class: `PhpCsFixer\\Tests\\Fixer\\Casing\\LowercaseKeywordsFixerTest <./../../../tests/Fixer/Casing/LowercaseKeywordsFixerTest.php>`_
  45. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.