mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-12-02 09:17:58 +01:00
Fix some pretty printing issues
This commit is contained in:
parent
8a3074db38
commit
e6b356af45
@ -18,6 +18,10 @@ abstract class NodeAbstract implements IteratorAggregate
|
|||||||
return $this->subNodes[$name];
|
return $this->subNodes[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __isset($name) {
|
||||||
|
return isset($this->subNodes[$name]);
|
||||||
|
}
|
||||||
|
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return substr(get_class($this), 5);
|
return substr(get_class($this), 5);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
|
|||||||
|
|
||||||
public function pStmt_ClassMethod(Node_Stmt_ClassMethod $node) {
|
public function pStmt_ClassMethod(Node_Stmt_ClassMethod $node) {
|
||||||
return $this->pModifiers($node->type)
|
return $this->pModifiers($node->type)
|
||||||
. 'function ' . $node->name
|
. 'function ' . ($node->byRef ? '&' : '') . $node->name
|
||||||
. '(' . $this->pCommaSeparated($node->params) . ')'
|
. '(' . $this->pCommaSeparated($node->params) . ')'
|
||||||
. (null !== $node->stmts
|
. (null !== $node->stmts
|
||||||
? "\n" . '{' . "\n" . $this->pIndent($this->pStmts($node->stmts)) . '}'
|
? "\n" . '{' . "\n" . $this->pIndent($this->pStmts($node->stmts)) . '}'
|
||||||
|
@ -120,7 +120,7 @@ abstract class PrettyPrinterAbstract
|
|||||||
if (isset($this->precedanceMap[$type])) {
|
if (isset($this->precedanceMap[$type])) {
|
||||||
$precedence = $this->precedanceMap[$type];
|
$precedence = $this->precedanceMap[$type];
|
||||||
|
|
||||||
if ($precedence > $this->precedenceStack[$this->precedenceStackPos]) {
|
if ($precedence >= $this->precedenceStack[$this->precedenceStackPos]) {
|
||||||
$this->precedenceStack[++$this->precedenceStackPos] = $precedence;
|
$this->precedenceStack[++$this->precedenceStackPos] = $precedence;
|
||||||
$return = '(' . $this->{'p' . $type}($node) . ')';
|
$return = '(' . $this->{'p' . $type}($node) . ')';
|
||||||
--$this->precedenceStackPos;
|
--$this->precedenceStackPos;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$DIR = '../../symfonySandbox';
|
$DIR = '../../Symfony';
|
||||||
|
|
||||||
function __autoload($class) {
|
function __autoload($class) {
|
||||||
is_file($file = '../lib/' . strtr($class, '_', '/') . '.php') && require_once $file;
|
is_file($file = '../lib/' . strtr($class, '_', '/') . '.php') && require_once $file;
|
||||||
|
Loading…
Reference in New Issue
Block a user