I am using PEAR PHP_Beautifier to try to format a large amount of legacy code and achieve some formatting of the array elements.
I wrote my own filter:
class PHP_Beautifier_Filter_ArrayIndent extends PHP_Beautifier_Filter { public function t_array($sTag) { if (($this->oBeaut->getNextTokenContent(1) === '(') && ($this->oBeaut->getNextTokenContent(2) !== ')')) {
I am trying to get the following format (with an opening bracket on the same line as the "array"):
public function doSomething(array $params = array()) { $dummy1 = array(); $dummy2 = array ( 'Hello' => 'World', 'Goodnight' => 'Vienna' ); }
but I get:
public function doSomething(array $params = array()) { $dummy1 = array(); $dummy2 = array ( 'Hello' => 'World', 'Goodnight' => 'Vienna' ); }
Is there a way to change / abort the next token after "t_array" or skip it so that I can handle the open shape in my filter?
source share