Closed (fixed)
Project:
Drupal Code Sniffer
Version:
7.x-1.0-alpha1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Mar 2012 at 17:33 UTC
Updated:
23 Mar 2012 at 18:30 UTC
First of all I'd like to say this is a great module.
I'm wondering about the error:
Empty CASE statements are not allowed
The pattern of using empty CASE statements is pretty common, for example it it used extensively in Drupal core code.
For example in common.inc on line 594:
switch ($code) {
case 200: // OK
case 304: // Not modified
break;
case 301: // Moved permanently
case 302: // Moved temporarily
case 307: // Moved temporarily
call_function();
break;
default:
$result->error = $status_message;
}
I don't see anywhere in the Drupal Coding standards that mentions blank case statements, and I can't think of a nicer way to represent a switch statement such as the above. So I'm wondering if this error should be removed from code sniffer.
Thanks.
Comments
Comment #1
klausiThanks for spotting this, I haven't thought of empty case statements that are actually useful. Fixed in this commit: http://drupalcode.org/project/drupalcs.git/commit/230cbbd