ereg_to_preg.rst 668 B

12345678910111213141516171819202122232425262728293031323334
  1. =====================
  2. Rule ``ereg_to_preg``
  3. =====================
  4. Replace deprecated ``ereg`` regular expression functions with ``preg``.
  5. .. warning:: Using this rule is risky.
  6. Risky if the ``ereg`` function is overridden.
  7. Examples
  8. --------
  9. Example #1
  10. ~~~~~~~~~~
  11. .. code-block:: diff
  12. --- Original
  13. +++ New
  14. @@ -1 +1 @@
  15. -<?php $x = ereg('[A-Z]');
  16. +<?php $x = preg_match('/[A-Z]/D');
  17. Rule sets
  18. ---------
  19. The rule is part of the following rule sets:
  20. @Symfony:risky
  21. Using the ``@Symfony:risky`` rule set will enable the ``ereg_to_preg`` rule.
  22. @PhpCsFixer:risky
  23. Using the ``@PhpCsFixer:risky`` rule set will enable the ``ereg_to_preg`` rule.