Closed ssandler closed 6 years ago
Probably need to add $builder->addHeredoc()
or similar; it's not going to be practical to try and detect heredocs in strings, given that HackCodegen doesn't put any restrictions on if a string is even a series of tokens, or even part of a token.
When trying to include a heredoc in a generated function, the indentation will break the heredoc.
This also happens when using
codegenHackBuilder
, below is just a simpler example usingbody()
directly with a string.Actual Result
The heredoc is indented such that it is not closed, creating a parse error in the file.
Expected Result
Heredocs and nowdocs could be treated specially so that they are not indented.
Or maybe Hack could adopt this RFC such that the generated code is actually valid :-) https://wiki.php.net/rfc/flexible_heredoc_nowdoc_indentation