mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Add goto support to pretty printer
This commit is contained in:
parent
4f3260f670
commit
d1f1fb9877
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
*/
|
||||
class Node_Stmt_Goto extends Node_Stmt
|
||||
{
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $name Name
|
||||
*/
|
||||
class Node_Stmt_Label extends Node_Stmt
|
||||
{
|
||||
}
|
@ -574,6 +574,14 @@ class PrettyPrinter_Zend extends PrettyPrinterAbstract
|
||||
return 'throw' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '');
|
||||
}
|
||||
|
||||
public function pStmt_Label(Node_Stmt_Label $node) {
|
||||
return $node->name . ':';
|
||||
}
|
||||
|
||||
public function pStmt_Goto(Node_Stmt_Goto $node) {
|
||||
return 'goto ' . $node->name;
|
||||
}
|
||||
|
||||
// Other
|
||||
|
||||
public function pStmt_Echo(Node_Stmt_Echo $node) {
|
||||
|
@ -82,6 +82,7 @@ abstract class PrettyPrinterAbstract
|
||||
|| $node instanceof Node_Stmt_Switch
|
||||
|| $node instanceof Node_Stmt_While
|
||||
|| $node instanceof Node_Stmt_TryCatch
|
||||
|| $node instanceof Node_Stmt_Label
|
||||
) {
|
||||
$return .= "\n";
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user