Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20687: Invert logic and rename variable to remove issue reference #10473

Merged
merged 1 commit into from
Jun 12, 2017
Merged

CRM-20687: Invert logic and rename variable to remove issue reference #10473

merged 1 commit into from
Jun 12, 2017

Conversation

mickadoo
Copy link
Contributor

@mickadoo mickadoo commented Jun 6, 2017

Using issue numbers as variables is not very self-explanatory and needs research or prior understanding just to understand the code. See CRM-16084 is enough here to provide a link to the context for the change.


The reason for inverting the logic is that I think it's more readable and suitable to this check. To simplify:

$add = TRUE;
foreach ($things as $thing) {
  if (isASpecialThing($thing)) {
    $add = FALSE;
    break;
  }
}

if ($add) {
  addSomething();
}

VS

$dontAdd = FALSE;
foreach ($things as $thing) {
  if (isASpecialThing($thing)) {
    $dontAdd = TRUE;
    break;
  }
}

if (!$dontAdd) {
  addSomething();
}

@omarabuhussein
Copy link
Member

oh I see , just noticed that you removed the invert (!) from if (!$crm16084) {

@omarabuhussein
Copy link
Member

omarabuhussein commented Jun 6, 2017

looks good to me @mickadoo ( approved from my side)

Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mickadoo. looks like a good improvement to the code. This can be merged @eileenmcnaughton

@eileenmcnaughton eileenmcnaughton merged commit a832798 into civicrm:master Jun 12, 2017
@mickadoo mickadoo deleted the CRM-20687-remove-issue-number-variables branch July 8, 2017 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants