You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an option to preserver the embedded new-line char? Either the parser or the pretty-printer is processing them into the real thing, which corrupts my code.
thanks, (observed in 0.9.3
The parser provides strings "as seen by PHP", i.e. in already parsed form. It does not retain the formatting of the string. Pretty printing with support for retaining formatting is discussed in #41.
In #26 you can find a solution for your particular issue with strings. The custom lexer will provide an originalValue attribute for constant encapsed strings, which you can then use in the pretty printer via:
public function pScalar_String(PHPParser_Node_Scalar_String $node) {
return $this->pNoIndent($node->getAttribute('originalValue'));
}
This approach will not work for non-constant (interpolated) strings though.
@nikic I followed your steps on #41 and #26. But now if I have HEREDOC string it will exclude it from the pretty printer. Can you check it and tell me what I can do to keep the HEREDOC?
Is there an option to preserver the embedded new-line char? Either the parser or the pretty-printer is processing them into the real thing, which corrupts my code.
thanks, (observed in 0.9.3
File:
Output file BarClass.php.f.php
thanks
The text was updated successfully, but these errors were encountered: