name Indentation Rules scope source.php - comment - meta.embedded.html - string, meta.html-newline-after-php settings decreaseIndentPattern )|(end(if|for(each)?|switch|while))\b) # followed by an keyword that ends a control flow block ) ]]> increaseIndentPattern "(?:[^"]++|\\.)*+"|'(?:[^']++|\\.)*+'){0} (?/\*(?:[^*]++|\*(?!/))*+\*/){0} (?(?:\g++|\g++|[^()'"/]++|/(?!\*))*+){0} (? \( # an open paren \g # followed by anything that's not a paren \g*+ # followed by any number of nested parens \g # followed by anything that's not a paren \) # a closing paren ){0} # begin rule ^.* # anything on the line followed by: ( \{[^}"']* # an open curly brace not followed by a closing brace or string punctuation | \[[^]"']* # an open square bracket not followed by a closing square bracket or string punctuation | \([^)"']* # an open bracket not followed by a closing bracket or string punctuation )$ | # 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 )\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 \s*:(?!.*\bend\k\b) # followed by a colon, and where the control structures don't end themselves on the same line ) ]]> indentNextLinePattern bracketIndentNextLinePattern (?x) ^ \s* \b(if|while|else|elseif|foreach)\b [^;]* $ | ^ \s* \b(for)\b .* $