lowercase_cast.rst 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. =======================
  2. Rule ``lowercase_cast``
  3. =======================
  4. Cast should be written in lower case.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. @@ -1,14 +1,14 @@
  13. <?php
  14. - $a = (BOOLEAN) $b;
  15. - $a = (BOOL) $b;
  16. - $a = (INTEGER) $b;
  17. - $a = (INT) $b;
  18. - $a = (DOUBLE) $b;
  19. - $a = (FLoaT) $b;
  20. - $a = (reaL) $b;
  21. - $a = (flOAT) $b;
  22. - $a = (sTRING) $b;
  23. - $a = (ARRAy) $b;
  24. - $a = (OBJect) $b;
  25. - $a = (UNset) $b;
  26. - $a = (Binary) $b;
  27. + $a = (boolean) $b;
  28. + $a = (bool) $b;
  29. + $a = (integer) $b;
  30. + $a = (int) $b;
  31. + $a = (double) $b;
  32. + $a = (float) $b;
  33. + $a = (real) $b;
  34. + $a = (float) $b;
  35. + $a = (string) $b;
  36. + $a = (array) $b;
  37. + $a = (object) $b;
  38. + $a = (unset) $b;
  39. + $a = (binary) $b;
  40. Example #2
  41. ~~~~~~~~~~
  42. .. code-block:: diff
  43. --- Original
  44. +++ New
  45. @@ -1,13 +1,13 @@
  46. <?php
  47. - $a = (BOOLEAN) $b;
  48. - $a = (BOOL) $b;
  49. - $a = (INTEGER) $b;
  50. - $a = (INT) $b;
  51. - $a = (DOUBLE) $b;
  52. - $a = (FLoaT) $b;
  53. - $a = (flOAT) $b;
  54. - $a = (sTRING) $b;
  55. - $a = (ARRAy) $b;
  56. - $a = (OBJect) $b;
  57. - $a = (UNset) $b;
  58. - $a = (Binary) $b;
  59. + $a = (boolean) $b;
  60. + $a = (bool) $b;
  61. + $a = (integer) $b;
  62. + $a = (int) $b;
  63. + $a = (double) $b;
  64. + $a = (float) $b;
  65. + $a = (float) $b;
  66. + $a = (string) $b;
  67. + $a = (array) $b;
  68. + $a = (object) $b;
  69. + $a = (unset) $b;
  70. + $a = (binary) $b;
  71. Rule sets
  72. ---------
  73. The rule is part of the following rule sets:
  74. @Symfony
  75. Using the ``@Symfony`` rule set will enable the ``lowercase_cast`` rule.
  76. @PhpCsFixer
  77. Using the ``@PhpCsFixer`` rule set will enable the ``lowercase_cast`` rule.