diff --git a/PHP/Indentation Rules.tmPreferences b/PHP/Indentation Rules.tmPreferences index d0582b2274..10c599be02 100644 --- a/PHP/Indentation Rules.tmPreferences +++ b/PHP/Indentation Rules.tmPreferences @@ -19,7 +19,7 @@ \s* [}\])] # optionally followed by whitespace, followed by a closing: curly brace, square bracket or paren | # OR \s* (<\?(php)?\s+)? # an optional PHP open tag - (else(\s*if)?\b.*:\s*($|//|/\*|\?>)|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block + (else(\s*if)?\b.*:\s*($|//|/\*|\?>)|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block ) ]]> @@ -46,7 +46,7 @@ | # OR ^\s* (<\?(php)?\s+)? # the beginning of the line followed by any amount of whitespace and an optional PHP open tag ( (?: - (?:else)?if\s*\g|else # PHP "if" related statements + (?:else\s*)?if\s*\g|else # PHP "if" related statements )\s*:(?!.*\bendif\b) # followed by a colon, not followed by an "endif" anywhere on the line | (?foreach|for|switch|while)\s*\g # PHP control keywords, followed by balanced parens @@ -54,9 +54,6 @@ ) ]]> - indentNextLinePattern - - bracketIndentNextLinePattern (?x) ^ \s* \b(if|while|else|elseif|foreach)\b [^;]* $ diff --git a/PHP/tests/syntax_test_indentation.php b/PHP/tests/syntax_test_indentation.php index aedf61266a..1e7d6cefbd 100644 --- a/PHP/tests/syntax_test_indentation.php +++ b/PHP/tests/syntax_test_indentation.php @@ -5,6 +5,8 @@ asdfadf asdf + + asdf qwfpg