function coder_postprocessor_if_curly_braces in Coder 5.2
Same name and namespace in other branches
- 5 scripts/coder_format/coder_format.inc \coder_postprocessor_if_curly_braces()
- 6.2 scripts/coder_format/coder_format.inc \coder_postprocessor_if_curly_braces()
- 6 scripts/coder_format/coder_format.inc \coder_postprocessor_if_curly_braces()
- 7.2 scripts/coder_format/coder_format.inc \coder_postprocessor_if_curly_braces()
- 7 scripts/coder_format/coder_format.inc \coder_postprocessor_if_curly_braces()
Related topics
File
- scripts/
coder_format/ coder_format.inc, line 1378
Code
function coder_postprocessor_if_curly_braces() {
// This post-processor relies on the fact that coder_format already
// re-formatted if statements without curly braces to be on one line.
return array(
'#title' => 'Use curly braces even in situations where they are technically optional.',
'#search' => '@
(\\s*) # match leading white-space, including newline
(if\\ \\(.+\\)\\ ) # match if statement
([^\\{].+;) # match conditional executed code not starting with a curly brace, delimited by a semicolon.
@x',
'#replace' => '$1$2{$1 $3$1}',
);
}