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

joe*_*sky 1 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;
  }
}
Run Code Online (Sandbox Code Playgroud)

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

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

Laz*_*One 6

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

看起来IDE不同步(一些内部结构)..所以"File | Invalidate Caches ..."应该在这里提供帮助.

PS你可以尝试它"你昨天/一小时前工作正常...现在相同的代码被打破"的情况(特别是当升级到较新的次要版本时).