-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments in multi-line string concatenation statement gets removed #1066
Comments
The comment is part of the AST:
But the pretty printer will only print comments that are at the statement (or some other kind of list) level, but not those nested inside expressions in odd ways. Using the formatting-preserving printer (https://github.com/nikic/PHP-Parser/blob/master/doc/component/Pretty_printing.markdown#formatting-preserving-pretty-printing) should retain this comment though. |
@nikic i tried this, but it doesn't seem to work. Example snippet
file.php contents
Output:
Version: 5.4.0 |
I think the problem with that code snippet is that CloningVisitor is not added to the NodeTraverser. |
For example
After processing, this comment gets removed when AST is converted to code with
new PrettyPrinter\Standard
The text was updated successfully, but these errors were encountered: