2

PhpStorm 检查声称在第二种情况下中断后的所有内容都无法访问。我不明白为什么。我错过了什么?

function mymodule_admin_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'taxonomy_overview_terms':
      // We need to add a submit handler to this form so we can save the weight
      // in Mongo.
      $form['#submit'][] = 'mymodule_admin_taxonomy_overview_submit_mongo';
      break;

      // Unwraps the mymodule News node form
    case 'mymodule_news_node_form':
      $form['#nowrap'] = true;

      $form['field_news_image']['#prefix'] = '<div class="row"><div class="large-5 columns">';
      $form['field_news_image']['#suffix'] = '</div></div>';

      $form['actions']['#prefix'] = '<div class="row"><div class="large-3 columns actions">';
      $form['actions']['#suffix'] = '</div></div>';

      break; // PhpStorm claims everything after this is unreachable ******

      // Unwraps the page forms
    case 'basic_page_with_multiple_images_node_form':
      $form['#nowrap'] = true;

      $form['field_bottom_image']['#prefix'] = '<div class="row"><div class="large-5 columns">';
      $form['field_bottom_image']['#suffix'] = '</div></div>';

      $form['actions']['#prefix'] = '<div class="row"><div class="large-3 columns actions">';
      $form['actions']['#suffix'] = '</div></div>';

      break;

    case 'page_node_form':
      $form['#nowrap'] = true;

      $form['field_bottom_image']['#prefix'] = '<div class="row"><div class="large-5 columns">';
      $form['field_bottom_image']['#suffix'] = '</div></div>';

      $form['actions']['#prefix'] = '<div class="row"><div class="large-3 columns actions">';
      $form['actions']['#suffix'] = '</div></div>';

      break;

    case 'basic_page_with_top_image':
      $form['#nowrap'] = true;

      $form['field_top_image']['#prefix'] = '<div class="row"><div class="large-5 columns">';
      $form['field_top_image']['#suffix'] = '</div></div>';

      $form['actions']['#prefix'] = '<div class="row"><div class="large-3 columns actions">';
      $form['actions']['#suffix'] = '</div></div>';

      break;

    case 'basic_page_with_inline_images_node_form':
      $form['#nowrap'] = true;

      $form['actions']['#prefix'] = '<div class="row"><div class="large-3 columns actions">';
      $form['actions']['#suffix'] = '</div></div>';

      break;
  }
}

我没有包含其余代码,因为 stackoverflow 告诉我我的问题有太多代码。

如您所见,在相关案例之后还有更多条件。如果前两个条件不满足,则应评估其余条件,因此其余代码是可访问的。这不正确吗?

4

1 回答 1

8

您的代码在 PhpStorm v7 中看起来很好——根本没有这样的错误消息。整体代码看起来不错。

看起来IDE不同步(一些内部结构)..所以“文件|无效缓存......”应该在这里有所帮助。

PS 当您遇到“昨天/一小时前运行良好......现在相同的代码被破坏”这种情况时(尤其是升级到较新的次要版本时),您可以尝试它。

于 2013-11-13T18:42:43.417 回答