PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » PHP_Beautifier » Bug #3257

Comments between if and elseif screws up formatting

Details

Submitted2005-01-21 03:01 UTC
Frombrandon at osuosl dot org
Assignedclbustos
StatusClosed
PackagePHP_Beautifier
PHP Version5.0.2
OSDebian Unstable
Roadmaps(Not assigned)

Comments

[2005-01-21 03:01 UTC] brandon at osuosl dot org

Description:
------------
The beautifier will cascade and start moving the indentations over if there is a comment between if {} and elseif {}

Reproduce code:
---------------
<?php

class Foo {
var $foobar = 0;
function Foo($a, $b) {
if ($a) {
dostuff();
}
// $a no good
elseif {
dootherstuff();
}
// $c maybe
elseif {
yea();
}
}

function bar() {
echo "Hello";
}
}

?>

Expected result:
----------------
Indentations being all under the class

Actual result:
--------------
$ php_beautifier -l "Pear() ArrayNested() ListClassFunction" foo.php |less

<?php
/*
* Class and Function List:
* Function list:
* - Foo()
* - bar()
* Classes list:
* - Foo
*/
class Foo {
var $foobar = 0;
function Foo($a, $b)
{
if ($a) {
dostuff();
}
// $a no good

elseif {
dootherstuff();
}
// $c maybe

elseif {
yea();
}
}
function bar()
{
echo "Hello";
}
}
?>