Note that there are some explanatory texts on larger screens.

plurals
  1. POPhpStorm - why is this case statement unreachable?
    primarykey
    data
    text
    <p>PhpStorm inspection is claiming that everything after the break in the second case is unreachable. I don't see why. What am I missing?</p> <pre class="lang-php prettyprint-override"><code>function mymodule_admin_form_alter(&amp;$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'] = '&lt;div class="row"&gt;&lt;div class="large-5 columns"&gt;'; $form['field_news_image']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; $form['actions']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-3 columns actions"&gt;'; $form['actions']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; 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'] = '&lt;div class="row"&gt;&lt;div class="large-5 columns"&gt;'; $form['field_bottom_image']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; $form['actions']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-3 columns actions"&gt;'; $form['actions']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; break; case 'page_node_form': $form['#nowrap'] = true; $form['field_bottom_image']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-5 columns"&gt;'; $form['field_bottom_image']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; $form['actions']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-3 columns actions"&gt;'; $form['actions']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; break; case 'basic_page_with_top_image': $form['#nowrap'] = true; $form['field_top_image']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-5 columns"&gt;'; $form['field_top_image']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; $form['actions']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-3 columns actions"&gt;'; $form['actions']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; break; case 'basic_page_with_inline_images_node_form': $form['#nowrap'] = true; $form['actions']['#prefix'] = '&lt;div class="row"&gt;&lt;div class="large-3 columns actions"&gt;'; $form['actions']['#suffix'] = '&lt;/div&gt;&lt;/div&gt;'; break; } } </code></pre> <p>I hadn't included the rest of the code because stackoverflow was telling me I had too much code for my question.</p> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload