non_printable_character.rst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ================================
  2. Rule ``non_printable_character``
  3. ================================
  4. Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other invisible
  5. unicode symbols.
  6. Warning
  7. -------
  8. Using this rule is risky
  9. ~~~~~~~~~~~~~~~~~~~~~~~~
  10. Risky when strings contain intended invisible characters.
  11. Configuration
  12. -------------
  13. ``use_escape_sequences_in_strings``
  14. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. Whether characters should be replaced with escape sequences in strings.
  16. Allowed types: ``bool``
  17. Default value: ``true``
  18. Examples
  19. --------
  20. Example #1
  21. ~~~~~~~~~~
  22. *Default* configuration.
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. -<?php echo "​Hello World !";
  27. +<?php echo "\u{200b}Hello\u{2007}World\u{a0}!";
  28. Example #2
  29. ~~~~~~~~~~
  30. With configuration: ``['use_escape_sequences_in_strings' => false]``.
  31. .. code-block:: diff
  32. --- Original
  33. +++ New
  34. -<?php echo "​Hello World !";
  35. +<?php echo "Hello World !";
  36. Rule sets
  37. ---------
  38. The rule is part of the following rule sets:
  39. - `@PHP70Migration:risky <./../../ruleSets/PHP70MigrationRisky.rst>`_
  40. - `@PHP71Migration:risky <./../../ruleSets/PHP71MigrationRisky.rst>`_
  41. - `@PHP74Migration:risky <./../../ruleSets/PHP74MigrationRisky.rst>`_
  42. - `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_
  43. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_
  44. - `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_