-
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
PSR-2 #70
Comments
I've just finished an early version of one, which you can find at https://github.com/tcopestake/PHP-Parser-PSR-2-pretty-printer There may be non-PSR-2 code generated by the default pretty printer that I'm unaware of and therefore haven't patched. If that's the case, feel free to let me know or add it in yourself. |
Thanks! I have been working on one as well. You may be further along than me, but I'll contribute back when I can. The existing printers and your, for instance like to mash long lines onto one line. I'm hoping to print onto a maximum of 120 chars and indent as required. It would be nice if the legal line feeds in existing code could be retained. That may be asking a lot. |
I won't be adding a PSR-2 printer to the main project (yet), because I don't think that it would work well enough right now. The current pretty printer is only supposed to output executable and human-readable/debuggable code, but doesn't really care about the formatting. Printing code in PSR-2 would require a bit of a different approach to be able to enforce line limits (as @kelfink mentioned). Right now the indentation of the current line is not known by the printing methods as it's only added after they have already finished (so you don't know how long the line actually is). Also I think that it wouldn't be particularly useful without the ability to retain some of the original formatting (issue #41). |
Does anyone have a PrettyPrinter compatible with PSR-2 ? Just in case...
The text was updated successfully, but these errors were encountered: