PhpStorm - 为什么这个案例声明无法访问?

时间:2013-11-13 14:45:12

标签: phpstorm

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告诉我我的问题代码太多了。

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

1 个答案:

答案 0 :(得分:6)

您的代码在PhpStorm v7中看起来很好 - 完全没有这样的错误消息。整体代码看起来很好。

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

P.S。 当你“昨天/一小时前工作正常......现在相同的代码被打破”时,你可以尝试一下这种情况(特别是升级到较新的次要版本时)。

相关问题