IIRC, we were told to use TRUE, FALSE, NULL, all uppercase, instead of true, false, null.

The only mention of this I can find now is:
"Constants should always be all-uppercase"
http://drupal.org/node/5993

But Coder doesn't flag lowercase "true", "false", "null" as errors. It this intentional?

Comments

Actually, if you do them in uppercase and choose the "Performance" option, you will see why. Lowercase is marginally faster than uppercase. I've pretty much switched to lowercase now.

We could never agree on the "performance" rules and I thought that the performance review was actually dropped. Maybe there's a coding standard reason to check for caps/lower, but and don't think that we should be checking for caps or lower case values at all. Just my opinion...

Well, I still see the performance stuff in the latest 5.x version. IMO, it has a few problems with quotes, but it's no big deal.

Personally I feel that the all caps version can be visually distracting in that it emphasizes some things that shouldn't be, such as those in the title here. I like Sql statements using caps, but code peppered with "TRUE," "FALSE," and "NULL" can make the code less readable, IMHO. I doubt the performance hit is significant enough to worry about, especially since we're using an interpreted language to start with.

I think that you have an old copy lying around. If you download coder from the project page, it doesn't package it because the CVS logs shows that it was DELETED on Aug 31, 2007:

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/coder/inclu...

// $Id: coder.module,v 1.55.2.19.4.18 2008/01/31 20:17:43 douggreen Exp $

When I update my modules, I don't delete the old one, just unpack the new code into the same directory. I do see that coder_performance has a pretty old date on it and it's not in my 6.x version. I guess I can safely delete that? Maybe I should actually uninstall, delete the directory, and re-install Coder.

yes

Status:Active» Closed (won't fix)

So, let's close this.

Presonally I prefer 'true', 'false', 'null', because they look "pure", and, besides, this isn't C. But, alas, I go with uppercase for consitency.

Thank you Nancy and Doug.

Re-opening this due to #283203: Use uppercase for PHP constants, e.g. NULL, TRUE, FALSE. Using uppercase TRUE, FALSE, NULL is part of the Drupal coding standards, therefore Coder should check for this. If you disagree with this coding standard, then you should put forward your case and try to get the standards changed.

NancyDru: do you have any references on the lowercase versions being faster?

Cheers,
Stella

Status:Closed (won't fix)» Active

Back when Coder had a performance section, this was the recommendation. Perhaps somewhere back in that feature request there was a reference.

I personally find these constants really ugly in uppercase when they are highlighted by my text editor.

Where do we start the discussion on the standards?

There's no clear place that I know of. I'd create an issue and put it either in the Drupal queue or the Drupal webmasters queue. Then send an email to the dev list to see if you can get a response there. You'd want something to back up the performance claim. A pure aesthetic type reason will not benefit your argument.

Cheers,
Stella

NancyDru: see Morbus' link. That's the appropriate place to post up any follow-ups you may have with references to back up your performance claim. If the coding standards are ever changed in the future, please feel free to re-open this issue. In the meantime, Drupal has coding standards, which Coder should enforce, so I'm not removing this check.

Cheers,
Stella

Status:Active» Closed (won't fix)

Well, in that case the 6.x version is broken because it doesn't flag lowercase.

NancyDru: the 6.x version has the same check in as the 5.x version. Can you double-check that you have the latest version installed? If it's still failing, can you paste in the line of code for which it fails to alert?

Cheers,
Stella