diff --git a/lib/Node/Scalar.php b/lib/Node/Scalar.php index 1e5d683..8d5de19 100644 --- a/lib/Node/Scalar.php +++ b/lib/Node/Scalar.php @@ -1,5 +1,5 @@ pClassName($node->class) . '::' - . ($node->func instanceof NodeAbstract ? $this->p($node->func) : $node->func) + . ($node->func instanceof Node_Expr ? $this->p($node->func) : $node->func) . '(' . $this->pCommaSeparated($node->args) . ')'; } @@ -606,7 +606,7 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract public function pObjectProperty($node) { if ($node instanceof Node_Variable || $node instanceof Node_Expr_ArrayDimFetch) { return $this->p($node); - } elseif ($node instanceof NodeAbstract) { + } elseif ($node instanceof Node_Expr) { return '{' . $this->p($node) . '}'; } else { return $node; @@ -635,12 +635,8 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract foreach ($encapsList as $element) { if (is_string($element)) { $return .= addcslashes($element, "\n\r\t\f\v$\"\\"); - } elseif ($element instanceof Node_Variable) { - if (is_string($element->name)) { - $return .= '$' . $element->name; - } else { - $return .= '{' . $this->p($element->name). '}'; - } + } elseif ($element instanceof Node_Variable && is_string($element->name)) { + $return .= '$' . $element->name; } else { $return .= '{' . $this->p($element) . '}'; } diff --git a/test.php b/test.php index ad980bd..301ab2a 100644 --- a/test.php +++ b/test.php @@ -35,7 +35,7 @@ $prettyPrinter = new PrettyPrinter_Zend; $code = $prettyPrinter->pStmts( $parser->yyparse( new Lexer(file_get_contents( - __FILE__ + '../symfonySandbox\src\vendor\symfony\src\Symfony\Components\Console\Input\InputDefinition.php' )), function ($msg) { echo $msg; diff --git a/test/testAgainstDirectory.php b/test/testAgainstDirectory.php index a4f4860..f0bcb4f 100644 --- a/test/testAgainstDirectory.php +++ b/test/testAgainstDirectory.php @@ -7,7 +7,6 @@ function __autoload($class) { } $parser = new Parser(); -$parser->yydebug = false; $prettyPrinter = new PrettyPrinter_Zend;