You are here

function coder_preprocessor_switch_duplicate_exit in Coder 6

Same name and namespace in other branches
  1. 5.2 scripts/coder_format/coder_format.inc \coder_preprocessor_switch_duplicate_exit()
  2. 5 scripts/coder_format/coder_format.inc \coder_preprocessor_switch_duplicate_exit()
  3. 6.2 scripts/coder_format/coder_format.inc \coder_preprocessor_switch_duplicate_exit()
  4. 7.2 scripts/coder_format/coder_format.inc \coder_preprocessor_switch_duplicate_exit()
  5. 7 scripts/coder_format/coder_format.inc \coder_preprocessor_switch_duplicate_exit()

Related topics

File

scripts/coder_format/coder_format.inc, line 1182

Code

function coder_preprocessor_switch_duplicate_exit() {
  return array(
    '#title' => 'Either exit a switch case with return *or* break.',
    '#search' => '@
      (return   # match a return
        \\s+     # - followed by some white-space
        .+      # - followed by any characters
        ;       # - followed by a semicolon
      )
      \\s+       # match white-space (required)
      break;    # match a directly following "break;"
      @mx',
    '#replace' => '$1',
  );
}