Ik get the "Functions should be called with no spaces between the function name" warning from the Coder module with the following php code:

$b_valid_type = (checkdate($a_date[1], $a_date[2], $a_date[0]) or (count($a_date) != 3)); // checkdate(): mm-dd-yyyy

The coder module complains about the ') or ('. Replacing it with ') or(' fixes it.

Am I to blame or should 'or' be excluded from the function check?

-H-

Comments

douggreen’s picture

Category: bug » support

While I don't think we have a coding standard for using '||' instead of 'or', I think that this is the defacto standard.

Is there any difference between '||' and 'or'? If not (and I don't think that there is), I'd change your code to be ) || (.

I'm more inclined to suggest that we clean up the coding standard, then add a rule to us '||' instead of 'or'.

mrharolda’s picture

Coder doesn't give a warning on ) || (, but as far as readability goes, I'd vote for 'or' as coding rule.

-H-

treksler’s picture

IMHO
using '||' instead of 'or' seems to be the Drupal standard and coder should enforce it

mrharolda’s picture

Status: Active » Closed (works as designed)

http://drupal.org/coding-standards

if (condition1 || condition2) {
  action1;
}

You're right...