Permalink
Browse files

Merge pull request #8 from Survos/fix-indentstyles

Fix IndentStyles so open brace after object operator isn't treated as start of a block
  • Loading branch information...
2 parents e8e89c0 + daa2311 commit b6376d5ff0607fee9169663cf7d40368aa0c88e6 @clbustos committed Jul 1, 2012
@@ -153,13 +153,18 @@ public function __call($sMethod, $aArgs)
*/
function t_open_brace_bsd($sTag)
{
- $this->oBeaut->addNewLineIndent();
- $this->oBeaut->add($sTag);
- if ($this->oBeaut->getControlSeq() == T_SWITCH) {
+ if ($this->oBeaut->openBraceDontProcess()) {
+ $this->oBeaut->add($sTag);
+ } else {
+ $this->oBeaut->removeWhitespace();
+ $this->oBeaut->addNewLineIndent();
+ $this->oBeaut->add($sTag);
+ if ($this->oBeaut->getControlSeq() == T_SWITCH) {
+ $this->oBeaut->incIndent();
+ }
$this->oBeaut->incIndent();
+ $this->oBeaut->addNewLineIndent();
}
- $this->oBeaut->incIndent();
- $this->oBeaut->addNewLineIndent();
}
/**
* t_close_brace_bsd: Close braces in BSD style
@@ -194,11 +199,16 @@ function t_close_brace_bsd($sTag)
*/
function t_open_brace_ws($sTag)
{
- $this->oBeaut->addNewLine();
- $this->oBeaut->incIndent();
- $this->oBeaut->addIndent();
- $this->oBeaut->add($sTag);
- $this->oBeaut->addNewLineIndent();
+ if ($this->oBeaut->openBraceDontProcess()) {
+ $this->oBeaut->add($sTag);
+ } else {
+ $this->oBeaut->removeWhitespace();
+ $this->oBeaut->addNewLine();
+ $this->oBeaut->incIndent();
+ $this->oBeaut->addIndent();
+ $this->oBeaut->add($sTag);
+ $this->oBeaut->addNewLineIndent();
+ }
}
/**
* t_close_brace_ws: Close braces in Whitesmiths style
@@ -252,12 +262,17 @@ function t_close_brace_gnu($sTag)
*/
function t_open_brace_gnu($sTag)
{
- $iHalfSpace = floor($this->oBeaut->iIndentNumber/2);
- $this->oBeaut->addNewLineIndent();
- $this->oBeaut->add(str_repeat($this->oBeaut->sIndentChar, $iHalfSpace));
- $this->oBeaut->add($sTag);
- $this->oBeaut->incIndent();
- $this->oBeaut->addNewLineIndent();
+ if ($this->oBeaut->openBraceDontProcess()) {
+ $this->oBeaut->add($sTag);
+ } else {
+ $this->oBeaut->removeWhitespace();
+ $iHalfSpace = floor($this->oBeaut->iIndentNumber/2);
+ $this->oBeaut->addNewLineIndent();
+ $this->oBeaut->add(str_repeat($this->oBeaut->sIndentChar, $iHalfSpace));
+ $this->oBeaut->add($sTag);
+ $this->oBeaut->incIndent();
+ $this->oBeaut->addNewLineIndent();
+ }
}
/**
* t_else: Else for bds, gnu & ws
@@ -1,8 +1,20 @@
<?php
-if ($x == 1)
+if ($x == 1)
{
$x = "Any text with {$x} sign";
}
+elseif ($x == 2)
+{
+ $x = "Any text with ${x} sign";
+}
+else
+{
+ $x = $object->{$property};
+}
if ($x == 1) $x = 2;
else $x = 3;
+while ($i++ < 4)
+{
+ $obj->{'set' . $prop}($i);
+}
?>
@@ -1,6 +1,20 @@
<?php
-if ($x == 1)
+if ($x == 1)
{
$x = "Any text with {$x} sign";
}
+elseif ($x == 2)
+ {
+ $x = "Any text with ${x} sign";
+ }
+else
+ {
+ $x = $object->{$property};
+ }
+if ($x == 1) $x = 2;
+else $x = 3;
+while ($i++ < 4)
+ {
+ $obj->{'set' . $prop}($i);
+ }
?>
@@ -2,4 +2,15 @@
if ($x == 1) {
$x = "Any text with {$x} sign";
}
+elseif ($x == 2) {
+ $x = "Any text with ${x} sign";
+}
+else {
+ $x = $object->{$property};
+}
+if ($x == 1) $x = 2;
+else $x = 3;
+while ($i++ < 4) {
+ $obj->{'set' . $prop}($i);
+}
?>
@@ -1,6 +1,20 @@
<?php
-if ($x == 1)
+if ($x == 1)
{
$x = "Any text with {$x} sign";
}
+elseif ($x == 2)
+ {
+ $x = "Any text with ${x} sign";
+ }
+else
+ {
+ $x = $object->{$property};
+ }
+if ($x == 1) $x = 2;
+else $x = 3;
+while ($i++ < 4)
+ {
+ $obj->{'set' . $prop}($i);
+ }
?>

0 comments on commit b6376d5

Please sign in to comment.