Closed (fixed)
Project:
Coder
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Jan 2007 at 13:38 UTC
Updated:
28 May 2014 at 08:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
douggreen commentedLooking at code-style.pl again, it looks like I misinterpreted the rule (I previously read the error message and didn't really look at the regex). Is SomethingCapitalized OK, but somethingCapital not?
Comment #2
yched commentedI think SomethingCapitalized is not OK either. It's probably more "StdClass" being an exception, since it's a PHP-defined keyword.
Comment #3
douggreen commentedthen shouldn't the Drupal coding standard be 'new stdclass();' - all lower case. I don't think php cares... I just tested on a php4 and php5 systems.
Comment #4
yched commentedWell, StdClass is PHP default syntax.
Even if typing stdclass instead happens to work, I'm not sure we can recommend coders to twist regular PHP syntax because it fits Drupal coding style better...
The best thing IMO probably be to set the string "StdClass" as a valid exception to the camelCase rule, I don't think there will be much others.
Comment #5
douggreen commentedOk, I'll add an exception. I've seen it on php.net as stdClass and StdClass. stdClass seems to be the standard. Do you think we should ignore both?
Comment #6
yched commentedi was not aware of the "stdClass" form, but drupal core 5 currently contains both.
So I guess yes, we should accept both...
Comment #7
douggreen commentedShould be fixed in the latest version!
Thanks!
Comment #8
webchickActually, probably better to pick one (you said stdClass is the most common on php.net?), update the coding standards accordingly, update the script so it only checks for that one, and submit patches to fix the inconsistencies.
That might be out of scope of this module though. ;)
Comment #9
webchickOk, between the facts that:
With Steven's ok, I've updated the coding standards to use "studlyCaps" on class names, and will roll a patch shortly. So if you could change it to only ok "stdClass" that would be cool. :)
Comment #10
webchickCore patch committed: http://drupal.org/node/107015
Here's a patch for coder module to make it only exclude stdClass.
Comment #11
douggreen commentedThanks yched and webchick. I've checked in something that will flag StdClass, but not stdClass. I simplified the regex because we don't need to compare words that start as caps.
Comment #12
douggreen commentedComment #13
phung_uit commented