Home » PHP » PHP_Beautifier » Bug #7312
missing spaces with < operator
Details
| Request #7312 | missing spaces with < operator |
|---|---|
| Submitted | 2006-04-05 12:09 UTC |
| From | pear at sebastianmendel dot de |
| Assigned | clbustos |
| Status | Closed |
| Package | PHP_Beautifier |
| PHP Version | 5.1.2 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2006-04-05 12:09 UTC] pear at sebastianmendel dot de
Description:
------------
missing spaces with < operator and after ; in for statemants
Expected result:
----------------
for ($i = 0; $i < count($result); $i++)
Actual result:
--------------
for ($i = 0;$i<count($result);$i++)
[2006-05-31 09:10 UTC] nicolasembleton at yahoo dot fr
This is very easy to correct actually.
You just have to create a 'token name' in the array in "Beautifier.php" => "public function __construct()" => "$aTokensToChange = array(".
Append at the end of the array ( or whereever you want, it doesn't matter ) the pattern you want to match ( like '<', '>', ... or '=>' will probably work too ), and create a new constant corresponding to your pattern.
ex: '>' => 'T_GREATER_THAN',
Then go in your filter.php and add a new function named by the name of your new constant ( or one already existing ) but in lowercase ( maybe uppercase will work, i don't know actually ) .
ex: function t_greater_than( $sTag )
In this function you can do everything you want.
ex: $this->oBeaut->add( ' ' .$sTag .' ' ) for your problem.
If someone want ( even the maintainer of the code ), i can send you the correct function and their places, to avoid you to work twice ;) )
[2006-06-02 08:53 UTC] clbustos at php dot net
You can do the same, without touching the base class. You have to create another filter, and call it with your Beautifier object.
[2006-06-02 10:28 UTC] pear at sebastianmendel dot de
i don't if i missed something but the PEAR coding standards writes that there should be spaces - and PHP_Beautifier does not do this even with filter PEAR - so this seems a bug and not a feature request, or not?
[2006-06-06 05:24 UTC] clbustos at php dot net
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/PHP_Beautifier
Fixed on PHP_Beautifier 0.1.9