Don't include whitespace directly in catch/finally print

This commit is contained in:
Nikita Popov 2017-01-21 21:25:48 +01:00
parent 5e565e8046
commit cb5dd28985
2 changed files with 5 additions and 5 deletions

View File

@ -757,18 +757,18 @@ class Standard extends PrettyPrinterAbstract
protected function pStmt_TryCatch(Stmt\TryCatch $node) {
return 'try {' . $this->pStmts($node->stmts) . "\n" . '}'
. $this->pImplode($node->catches)
. ($node->finally !== null ? $this->p($node->finally) : '');
. ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '')
. ($node->finally !== null ? ' ' . $this->p($node->finally) : '');
}
protected function pStmt_Catch(Stmt\Catch_ $node) {
return ' catch (' . $this->pImplode($node->types, '|') . ' '
return 'catch (' . $this->pImplode($node->types, '|') . ' '
. $this->p($node->var)
. ') {' . $this->pStmts($node->stmts) . "\n" . '}';
}
protected function pStmt_Finally(Stmt\Finally_ $node) {
return ' finally {' . $this->pStmts($node->stmts) . "\n" . '}';
return 'finally {' . $this->pStmts($node->stmts) . "\n" . '}';
}
protected function pStmt_Break(Stmt\Break_ $node) {

View File

@ -150,7 +150,7 @@ $var = 'abc'
try {
} catch (X
$y) {
} finally {
} finally {
}
-----
<?php