Generic/UnnecessaryHeredoc: 2 bug fixes involving escape sequences #1040
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Generic/UnnecessaryHeredoc: bug fix - stray backslashes after fixing
If the original heredoc contained an escaped variable or an escaped backslash (neither of which need heredoc), the nowdoc version of the text string would contain stray backslashes as these escapes are not needed in nowdocs, so would be interpreted as literals.
Fixed now.
Includes tests.
Generic/UnnecessaryHeredoc: bug fix - false positives for heredoc with escape sequence
If the original heredoc contained an escape sequence, but no variable interpolation or expressions, it would be flagged as unnecessary and fixed to nowdoc, even though escape sequences are not supported in nowdocs.
Fixed now.
Includes tests.
Suggested changelog entry
Fixed: Generic.Strings.UnnecessaryHeredoc - false positive for heredocs containing escape sequences
Fixed: Generic.Strings.UnnecessaryHeredoc - fixer would not clean up escape sequences which aren't needed in nowdocs
Related issues/external references
Follow up on #633