PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

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";
}
}
?>