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

Merge branch '3.x'

Conflicts:
	test/PhpParser/PrettyPrinterTest.php
This commit is contained in:
Nikita Popov 2017-01-29 21:57:37 +01:00
commit e072c789d1
2 changed files with 16 additions and 0 deletions

View File

@ -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) . '}';

View File

@ -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>