Commit 7c86cae
Generic/LanguageConstructSpacing: exclude space from prepareForOutput()
This sniff uses `Common::prepareForOutput()` in two places to make
whitespace visible in error messages. Among other things, the method
replaces spaces with a UTF-8 middot character. The middot character
in the output can break tools that pipe PHPCS output through non-UTF-8
environments (see squizlabs/PHP_CodeSniffer 2652).
For the `IncorrectSingle` error, the spaces-only case now reports a
descriptive count like "found 2 spaces" instead of displaying
middot characters. For tabs or newlines, `prepareForOutput()` is kept
but with `[' ']` as the `$exclude` parameter, so that any spaces in the
content are displayed as-is.
For the `IncorrectYieldFrom` and `IncorrectYieldFromWithComment` errors,
the same `$exclude` parameter is passed, so that spaces between `yield`
and `from` are no longer replaced with middots.1 parent df21713 commit 7c86cae
File tree
1 file changed
+11
-3
lines changed- src/Standards/Generic/Sniffs/WhiteSpace
1 file changed
+11
-3
lines changedLines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
| |||
0 commit comments