I think it shouldn't be too difficult to bastardize perltidy to make it applicable on php code. I for one have indeed already used the off-the-shelf version of perltidy on small php scripts. Of course this messes up the php-code significantly, however, in places the php code remains correct and pretty printed.
For instance, nested data structures get beautified properly. Usually I cut-and-paste the correct portions of the newly-formatted code back into my old code. This can be done just by lookng at the source code.
These are a few of the potential benefits of a prospective perlphptidy that come to mind:
* There is apparently no good, free php beautifier. The software I tried before falls short to perltidy's capabilities.
* Regarding PHP's popularity I assume this perl-based php-tidy would become very popular very quickly and this project would get a boost.
* The php crowd would be forced -benevolently- to turn its attention back to perl
* It should be very easy to get a good head-start just by telling perltidy to leave php's c-style-comments intact.
If you developers think this feature request was infeasible, let me know. Then I will hack the perltidy script by myself to fit my needs.
Or, regarding the fact that the need for a perlphptidy is so obvious... maybe something like the thing above exists already?
Log in to post a comment.