Skip to content

Latest commit

 

History

History
76 lines (50 loc) · 2.07 KB

non_printable_character.rst

File metadata and controls

76 lines (50 loc) · 2.07 KB

Rule non_printable_character

Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other invisible unicode symbols.

Warning

Using this rule is risky

Risky when strings contain intended invisible characters.

Configuration

use_escape_sequences_in_strings

Whether characters should be replaced with escape sequences in strings.

Allowed types: bool

Default value: true

Examples

Example #1

Default configuration.

--- Original
+++ New
-<?php echo "​Hello World !";
+<?php echo "\u{200b}Hello\u{2007}World\u{a0}!";

Example #2

With configuration: ['use_escape_sequences_in_strings' => false].

--- Original
+++ New
-<?php echo "​Hello World !";
+<?php echo "Hello World !";

Rule sets

The rule is part of the following rule sets:

@PHP70Migration:risky
Using the @PHP70Migration:risky rule set will enable the non_printable_character rule with the default config.
@PHP71Migration:risky
Using the @PHP71Migration:risky rule set will enable the non_printable_character rule with the default config.
@PHP74Migration:risky
Using the @PHP74Migration:risky rule set will enable the non_printable_character rule with the default config.
@PHP80Migration:risky
Using the @PHP80Migration:risky rule set will enable the non_printable_character rule with the default config.
@PhpCsFixer:risky
Using the @PhpCsFixer:risky rule set will enable the non_printable_character rule with the default config.
@Symfony:risky
Using the @Symfony:risky rule set will enable the non_printable_character rule with the default config.