PhpStorm inspection is claiming that everything after the break in the second case is unreachable. I don't see why. What am I missing?
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;
}
}
I hadn't included the rest of the code because stackoverflow was telling me I had too much code for my question.
As you can see there are more conditions after the case in question. If the first two conditions are not met, the rest should be evaluated, therefor the rest of the code is reachable. Is this not correct?
Your code is looking fine here in PhpStorm v7 -- no such error messages at all. And overall code looks fine.
Looks like IDE is out-of-sync (some internal structures) .. so "File | Invalidate Caches..." should help here.
P.S. You can try it when you have "it worked fine yesterday/an hour ago .. and now the same code is broken" kind of situation (especially when upgrading to the newer minor version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With