constant_case.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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'`` and ``'upper'``
  12. Default value: ``'lower'``
  13. Examples
  14. --------
  15. Example #1
  16. ~~~~~~~~~~
  17. *Default* configuration.
  18. .. code-block:: diff
  19. --- Original
  20. +++ New
  21. <?php
  22. -$a = FALSE;
  23. -$b = True;
  24. -$c = nuLL;
  25. +$a = false;
  26. +$b = true;
  27. +$c = null;
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['case' => 'upper']``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. <?php
  35. $a = FALSE;
  36. -$b = True;
  37. -$c = nuLL;
  38. +$b = TRUE;
  39. +$c = NULL;
  40. Rule sets
  41. ---------
  42. The rule is part of the following rule sets:
  43. - `@PER <./../../ruleSets/PER.rst>`_
  44. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  45. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  46. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  47. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  48. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  49. - `@Symfony <./../../ruleSets/Symfony.rst>`_