Skip to content

Conversation

@kcivey
Copy link
Contributor

@kcivey kcivey commented Jun 24, 2012

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

@akalongman
Copy link

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 cdx@users.sourceforge.com - @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(); } } } ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants