Move leading space out of pStmt_ElseIf

This is not part of the elseif itself and as such belongs in the
pStmt_If printer.
This commit is contained in:
Nikita Popov 2017-10-06 14:52:52 +02:00
parent 310155832a
commit e3888cbe02
2 changed files with 3 additions and 3 deletions

View File

@ -716,12 +716,12 @@ class Standard extends PrettyPrinterAbstract
protected function pStmt_If(Stmt\If_ $node) {
return 'if (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->stmts) . $this->nl . '}'
. $this->pImplode($node->elseifs)
. ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '')
. (null !== $node->else ? $this->p($node->else) : '');
}
protected function pStmt_ElseIf(Stmt\ElseIf_ $node) {
return ' elseif (' . $this->p($node->cond) . ') {'
return 'elseif (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->stmts) . $this->nl . '}';
}

View File

@ -1076,7 +1076,7 @@ abstract class PrettyPrinterAbstract
//'Expr_ShellExec->parts' => '', // TODO These need to be treated more carefully
//'Scalar_Encapsed->parts' => '',
'Stmt_Catch->types' => '|',
'Stmt_If->elseifs' => '', // TODO move space out of ElseIf printer?
'Stmt_If->elseifs' => ' ',
'Stmt_TryCatch->catches' => ' ',
// comma-separated lists