From: "Robert P. J. Day" on

i'm trying to figure out the rationale for how the beautifier adds
newlines WRT to comments: here's my trivial input test file:

=====
<?php

// c1
// c2
// c3
/*
* and a longer comment
*/
// c4
if (true) $x = 2;

?>
=====
as you can see, several individual comments. so let's add a newline
*before* comments:

=====
$ php_beautifier -l "NewLines(before=T_COMMENT)" t1.php
<?php
// c1

// c2

// c3

/*
* and a longer comment
*/
// c4
if (true) $x = 2;
?>
$
=====

curious ... there was no newline added before that final "c4"
comment. and why did the beautifier toss the leading spaces before
the second and third lines of that multi-line comment? that really
makes a mess of the way most people line up their comments with the
"/*" and "*/" comment symbols.

now, let's try it with adding newlines *after* comments:

=====
$ php_beautifier -l "NewLines(after=T_COMMENT)" t1.php
<?php

// c1
// c2

// c3

/*

* and a longer comment
*/

// c4
if (true) $x = 2;
?>
$
=====

that's just weird. and wrong. am i doing something wrong here?

rday

p.s. like others, i am not happy that the beautifier happily tosses
blank lines out of the source. is there no option to specify to leave
blank lines where they are?

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================