PHP_Beautifier icon indicating copy to clipboard operation
PHP_Beautifier copied to clipboard

remove space between ")" and "," when using ArrayNested filter

Open kcivey opened this issue 12 years ago • 1 comments

I'm assuming the space before the comma after an array when using the ArrayNested filter is unintentional. This patch gets rid of it.

kcivey avatar Jun 24 '12 19:06 kcivey

Replace content in pear/php/Beautifier/Filter/ArrayNested.filter.php as this:

- $aMyArray = array( - array( - array( - array( - 'el'=>1, - 'el'=>2 - ) - ) - ) - ); - - @category PHP - @package PHP_Beautifier - @subpackage Filter - @author Claudio Bustos [email protected] - @copyright 2004-2010 Claudio Bustos - @link http://pear.php.net/package/PHP_Beautifier - @link http://beautifyphp.sourceforge.net - @license http://www.php.net/license/3_0.txt PHP License 3.0 - @version Release: 0.1.15 */ class PHP_Beautifier_Filter_ArrayNested extends PHP_Beautifier_Filter { public function t_parenthesis_open($sTag) { $this->oBeaut->add($sTag); if ($this->oBeaut->getControlParenthesis() == T_ARRAY) { $this->oBeaut->addNewLine(); $this->oBeaut->incIndent(); $this->oBeaut->addIndent(); } } public function t_parenthesis_close($sTag) { $this->oBeaut->removeWhitespace(); if ($this->oBeaut->getControlParenthesis() == T_ARRAY) { $this->oBeaut->decIndent(); if ($this->oBeaut->getPreviousTokenContent() != '(') { $this->oBeaut->addNewLine(); $this->oBeaut->addIndent(); } $this->oBeaut->add($sTag); } else { $this->oBeaut->add($sTag); } } public function t_comma($sTag) { if ($this->oBeaut->getControlParenthesis() != T_ARRAY) { $this->oBeaut->add($sTag); } else { $this->oBeaut->add($sTag); $this->oBeaut->addNewLine(); $this->oBeaut->addIndent(); } } } ?>

akalongman avatar Jan 11 '13 14:01 akalongman