How does the below piece of code relate to the Drupal coding standards? Notice that this function is not returning anything.
$a = foo();
function foo() {
// …
drupal_func();
}
Somebody claims that:
- the assignment to the variable is for the future because that way it is easier later to refactor
foo()
. However, the code does not use$a
, now. - Drupal people often do this kind of practice, which is even in Drupal core.
Is this valid?
Should this be kept in the code?
We agreed to keep Drupal coding standards in our project. I was doing a code review of my friend's code and he insisted on keeping that code (using arguments that it is used inside Drupal core, but I couldn't find an example myself) while I was trying to convince him to remove $a
. We couldn't reach an agreement, so I decided to reach out for help.