Closed GromNaN closed 9 months ago
Thanks for the fix @dg. Isn't it possible to keep the heredoc/nowdoc in the function body?
In principle, since PHP 7.3 it is possible, I will try to implement it.
@GromNaN it should be working in master by now, can you test it?
Perfect, it works. The upgrade to nikic/php-parser: v5.0.0
was not required but nice to have.
Thank you!
Version: 4.1.2
Bug Description
When a PHP file contains a heredoc or a nowdic, it is converted to a double-quoted string by the parsed. This transforms the contents of a the files that are modified using this package, and this can generate invalid PHP syntax if the string contains a double quote.
Steps To Reproduce
Create a file that contains a heredoc or a nowdoc (called
file.php
):Create a script that reads this file, parse it and dump it:
Run the script.
The result is an invalid PHP file with the string inlined in double quotes.
Expected Behavior
The output should be identical to the input
file.php
.Possible Solution
No idea, sorry.