diff --git a/Beautifier.php b/Beautifier.php index afdd1bb..9148237 100755 --- a/Beautifier.php +++ b/Beautifier.php @@ -1819,5 +1819,16 @@ public function openBraceDontProcess() or ($this->isPreviousTokenConstant(T_STRING) and $this->getPreviousTokenConstant(2) == T_OBJECT_OPERATOR) or $this->getMode('double_quote'); } + + /** + * getLastSeq: Return the last sequence block opened and not closed + * + * @access public + * @return int + */ + public function getLastSeq() + { + return $this->aControlSeq[count($this->aControlSeq)-1]; + } } ?> diff --git a/Beautifier/Filter/IndentStyles.filter.php b/Beautifier/Filter/IndentStyles.filter.php index fa98c45..b11b32c 100755 --- a/Beautifier/Filter/IndentStyles.filter.php +++ b/Beautifier/Filter/IndentStyles.filter.php @@ -155,6 +155,9 @@ function t_open_brace_bsd($sTag) { $this->oBeaut->addNewLineIndent(); $this->oBeaut->add($sTag); + if ($this->oBeaut->getLastSeq() == T_SWITCH) { + $this->oBeaut->incIndent(); + } $this->oBeaut->incIndent(); $this->oBeaut->addNewLineIndent(); } @@ -173,6 +176,9 @@ function t_close_brace_bsd($sTag) } else { $this->oBeaut->removeWhitespace(); $this->oBeaut->decIndent(); + if ($this->oBeaut->getLastSeq() == T_SWITCH) { + $this->oBeaut->decIndent(); + } $this->oBeaut->addNewLineIndent(); $this->oBeaut->add($sTag); $this->oBeaut->addNewLineIndent();