phpowermove / php-code-generator

PHP code generator library
https://php-code-generator.readthedocs.org
Apache License 2.0
147 stars 43 forks source link

fix heredoc indent #43

Closed stramunin closed 1 year ago

stramunin commented 7 years ago

Don't indent closing indetifier Heredoc

The closing identifier must begin in the first column of the line.(http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)

gossi commented 7 years ago

Looks good. Can you provide test cases? (I never use heredoc :p)

stramunin commented 7 years ago

In old project heredoc is often used. In one of the projects in which I participate, it is also used. Without this fix, the generated classes (with heredoc) will have a syntax error. I can write tests later.

gossi commented 6 years ago

I'm wondering, whether the Writer is a good place to do that, since you tokenize the code. I would rather see this in two steps, keeping the writer as is?

Also please provide test cases. If this all comes down, I'd love to include this in v0.6.