The sniff in Drupal_Sniffs_NamingConventions_ValidGlobalSniff says, "global variables should start with a single underscore followed by the module and another underscore". This standard only applies to contrib modules and themes. Can we amend the sniff so it doesn't complain about globals like $user, $theme, and $conf in core modules?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupalcs-missing-language_interface-global-1535558-2.patch | 673 bytes | traviscarden |
Comments
Comment #1
klausiThere is a white list of core globals in NamingConventions/ValidGlobalSniff.php, feel free to create a bug report if a particular global is missing.
Comment #2
traviscarden commentedAh! Thank you. Then the problem is that
$language_interfaceis missing from the whitelist. Here's a patch.Comment #3
arnested commentedPatch looks fine to me.
$language_interface is a Drupal 8-only global variable. Don't know whether that should be addressed in some special way?
Comment #4
klausiCommitted #2: http://drupalcode.org/project/drupalcs.git/commit/fda9b1d
@arnested: I don't think that special casing is necessary. It only means that if there is a contrib module in D6 or D7 using global $language_interface then drupalcs will not throw an error. This is an unlikely edge case and acceptable.