constant_case.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ======================
  2. Rule ``constant_case``
  3. ======================
  4. The PHP constants ``true``, ``false``, and ``null`` MUST be written using the
  5. correct casing.
  6. Configuration
  7. -------------
  8. ``case``
  9. ~~~~~~~~
  10. Whether to use the ``upper`` or ``lower`` case syntax.
  11. Allowed values: ``'lower'``, ``'upper'``
  12. Default value: ``'lower'``
  13. Examples
  14. --------
  15. Example #1
  16. ~~~~~~~~~~
  17. *Default* configuration.
  18. .. code-block:: diff
  19. --- Original
  20. +++ New
  21. @@ -1,4 +1,4 @@
  22. <?php
  23. -$a = FALSE;
  24. -$b = True;
  25. -$c = nuLL;
  26. +$a = false;
  27. +$b = true;
  28. +$c = null;
  29. Example #2
  30. ~~~~~~~~~~
  31. With configuration: ``['case' => 'upper']``.
  32. .. code-block:: diff
  33. --- Original
  34. +++ New
  35. @@ -1,4 +1,4 @@
  36. <?php
  37. $a = FALSE;
  38. -$b = True;
  39. -$c = nuLL;
  40. +$b = TRUE;
  41. +$c = NULL;
  42. Rule sets
  43. ---------
  44. The rule is part of the following rule sets:
  45. @PSR2
  46. Using the ``@PSR2`` rule set will enable the ``constant_case`` rule with the default config.
  47. @Symfony
  48. Using the ``@Symfony`` rule set will enable the ``constant_case`` rule with the default config.
  49. @PhpCsFixer
  50. Using the ``@PhpCsFixer`` rule set will enable the ``constant_case`` rule with the default config.