1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +01:00

Fix some pretty printing issues

This commit is contained in:
nikic 2011-05-30 22:11:11 +02:00
parent 8a3074db38
commit e6b356af45
4 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,10 @@ abstract class NodeAbstract implements IteratorAggregate
return $this->subNodes[$name];
}
public function __isset($name) {
return isset($this->subNodes[$name]);
}
public function getType() {
return substr(get_class($this), 5);
}

View File

@ -458,7 +458,7 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
public function pStmt_ClassMethod(Node_Stmt_ClassMethod $node) {
return $this->pModifiers($node->type)
. 'function ' . $node->name
. 'function ' . ($node->byRef ? '&' : '') . $node->name
. '(' . $this->pCommaSeparated($node->params) . ')'
. (null !== $node->stmts
? "\n" . '{' . "\n" . $this->pIndent($this->pStmts($node->stmts)) . '}'

View File

@ -120,7 +120,7 @@ abstract class PrettyPrinterAbstract
if (isset($this->precedanceMap[$type])) {
$precedence = $this->precedanceMap[$type];
if ($precedence > $this->precedenceStack[$this->precedenceStackPos]) {
if ($precedence >= $this->precedenceStack[$this->precedenceStackPos]) {
$this->precedenceStack[++$this->precedenceStackPos] = $precedence;
$return = '(' . $this->{'p' . $type}($node) . ')';
--$this->precedenceStackPos;

View File

@ -1,6 +1,6 @@
<?php
$DIR = '../../symfonySandbox';
$DIR = '../../Symfony';
function __autoload($class) {
is_file($file = '../lib/' . strtr($class, '_', '/') . '.php') && require_once $file;