no_alias_functions.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. ===========================
  2. Rule ``no_alias_functions``
  3. ===========================
  4. Master functions shall be used instead of aliases.
  5. .. warning:: Using this rule is risky.
  6. Risky when any of the alias functions are overridden.
  7. Configuration
  8. -------------
  9. ``sets``
  10. ~~~~~~~~
  11. List of sets to fix. Defined sets are ``@internal`` (native functions),
  12. ``@IMAP`` (IMAP functions), ``@mbreg`` (from ``ext-mbstring``) ``@all`` (all
  13. listed sets).
  14. Allowed values: a subset of ``['@internal', '@IMAP', '@mbreg', '@all', '@time', '@exif']``
  15. Default value: ``['@internal', '@IMAP']``
  16. Examples
  17. --------
  18. Example #1
  19. ~~~~~~~~~~
  20. *Default* configuration.
  21. .. code-block:: diff
  22. --- Original
  23. +++ New
  24. @@ -1,22 +1,22 @@
  25. <?php
  26. -$a = chop($b);
  27. -close($b);
  28. -$a = doubleval($b);
  29. -$a = fputs($b, $c);
  30. -$a = get_required_files();
  31. -ini_alter($b, $c);
  32. -$a = is_double($b);
  33. -$a = is_integer($b);
  34. -$a = is_long($b);
  35. -$a = is_real($b);
  36. -$a = is_writeable($b);
  37. -$a = join($glue, $pieces);
  38. -$a = key_exists($key, $array);
  39. -magic_quotes_runtime($new_setting);
  40. -$a = pos($array);
  41. -$a = show_source($filename, true);
  42. -$a = sizeof($b);
  43. -$a = strchr($haystack, $needle);
  44. -$a = imap_header($imap_stream, 1);
  45. -user_error($message);
  46. +$a = rtrim($b);
  47. +closedir($b);
  48. +$a = floatval($b);
  49. +$a = fwrite($b, $c);
  50. +$a = get_included_files();
  51. +ini_set($b, $c);
  52. +$a = is_float($b);
  53. +$a = is_int($b);
  54. +$a = is_int($b);
  55. +$a = is_float($b);
  56. +$a = is_writable($b);
  57. +$a = implode($glue, $pieces);
  58. +$a = array_key_exists($key, $array);
  59. +set_magic_quotes_runtime($new_setting);
  60. +$a = current($array);
  61. +$a = highlight_file($filename, true);
  62. +$a = count($b);
  63. +$a = strstr($haystack, $needle);
  64. +$a = imap_headerinfo($imap_stream, 1);
  65. +trigger_error($message);
  66. mbereg_search_getregs();
  67. Example #2
  68. ~~~~~~~~~~
  69. With configuration: ``['sets' => ['@mbreg']]``.
  70. .. code-block:: diff
  71. --- Original
  72. +++ New
  73. @@ -1,3 +1,3 @@
  74. <?php
  75. $a = is_double($b);
  76. -mbereg_search_getregs();
  77. +mb_ereg_search_getregs();
  78. Rule sets
  79. ---------
  80. The rule is part of the following rule sets:
  81. @Symfony:risky
  82. Using the ``@Symfony:risky`` rule set will enable the ``no_alias_functions`` rule with the default config.
  83. @PhpCsFixer:risky
  84. Using the ``@PhpCsFixer:risky`` rule set will enable the ``no_alias_functions`` rule with the config below:
  85. ``['sets' => ['@all']]``
  86. @PHP74Migration:risky
  87. Using the ``@PHP74Migration:risky`` rule set will enable the ``no_alias_functions`` rule with the default config.
  88. @PHP80Migration:risky
  89. Using the ``@PHP80Migration:risky`` rule set will enable the ``no_alias_functions`` rule with the config below:
  90. ``['sets' => ['@all']]``