mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Merge branch '3.x'
Conflicts: test/PhpParser/PrettyPrinterTest.php
This commit is contained in:
commit
e072c789d1
@ -493,6 +493,10 @@ class Standard extends PrettyPrinterAbstract
|
||||
|
||||
// Other
|
||||
|
||||
protected function pExpr_Error(Expr\Error $node) {
|
||||
throw new \LogicException('Cannot pretty-print AST with Error nodes');
|
||||
}
|
||||
|
||||
protected function pExpr_Variable(Expr\Variable $node) {
|
||||
if ($node->name instanceof Expr) {
|
||||
return '${' . $this->p($node->name) . '}';
|
||||
|
@ -188,6 +188,18 @@ class PrettyPrinterTest extends CodeTestAbstract
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Cannot pretty-print AST with Error nodes
|
||||
*/
|
||||
public function testPrettyPrintWithError() {
|
||||
$stmts = [new Stmt\Expression(
|
||||
new Expr\PropertyFetch(new Expr\Variable('a'), new Expr\Error())
|
||||
)];
|
||||
$prettyPrinter = new PrettyPrinter\Standard;
|
||||
$prettyPrinter->prettyPrint($stmts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideTestFormatPreservingPrint
|
||||
* @covers \PhpParser\PrettyPrinter\Standard<extended>
|
||||
|
Loading…
Reference in New Issue
Block a user