Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In my newest module for Drupal I've been using the new DateTime objects in PHP 5.2 and the methods for these objects use camelCase. Coder reports this even though there is nothing wrong with my code. I suggest ignoring camelCased methods since there's no object-oriented features in Drupal right now, so any method like that would probably be a PHP built-in.
Comments
Comment #1
douggreen CreditAttribution: douggreen commentedGood suggestion! The rule is on line 212 of includes/coder_style.inc. If you come up with the appropriate backtrace exclusion, please submit a patch. I tried quite a few and couldn't figure it out.
Comment #2
Susurrus CreditAttribution: Susurrus commentedI think that any CamelCased method used in Drupal or a contributed module would almost definitely be a PHP built-in versus a user-created one. I think that it would probably be safe just to ignore all CamelCased methods and stick to checking only for CamelCase variables.
Comment #3
MrHaroldA CreditAttribution: MrHaroldA commentedI also think that it would probably be safe just to ignore all CamelCased methods and stick to checking only for CamelCase variables.
I use the simpletest module and that module uses lots of PHP 5 CamelCase classes.
Also the SimpleXMLElement class is not very appreciated by the Coder module ;)
-H-
Comment #4
douggreen CreditAttribution: douggreen commentedI changed the camelCase rule to only check for variable (i.e., $camelCase) and function declarations (i.e., function camelCase), and I removed the special rules that excluded hex numbers and StdClass.
Comment #5
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.