mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Add "kind" attribute to Stmt\Exit_
Attribute specifies whether this is a "die" or an "exit" and the pretty printer behaves accordingly.
This commit is contained in:
parent
7eac2cfd8b
commit
47c342a3e4
@ -201,6 +201,10 @@ class Lexer
|
||||
$endAttributes['endFilePos'] = $this->filePos - 1;
|
||||
}
|
||||
|
||||
if ($token[0] === T_EXIT) {
|
||||
$startAttributes['kind'] = strtolower($token[1]);
|
||||
}
|
||||
|
||||
return $this->tokenMap[$token[0]];
|
||||
}
|
||||
}
|
||||
|
@ -493,7 +493,8 @@ class Standard extends PrettyPrinterAbstract
|
||||
}
|
||||
|
||||
public function pExpr_Exit(Expr\Exit_ $node) {
|
||||
return 'die' . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
|
||||
return $node->getAttribute('kind', 'die')
|
||||
. (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
|
||||
}
|
||||
|
||||
public function pExpr_Yield(Expr\Yield_ $node) {
|
||||
|
@ -19,9 +19,9 @@ isset($a, $a[$b]);
|
||||
empty($a);
|
||||
empty('foo');
|
||||
unset($a, $a[$b]);
|
||||
die;
|
||||
die;
|
||||
die(1);
|
||||
exit;
|
||||
exit;
|
||||
exit(1);
|
||||
die;
|
||||
die;
|
||||
die('foo');
|
||||
|
Loading…
Reference in New Issue
Block a user