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

Make else statement more legible #15974

Merged
merged 1 commit into from
Dec 2, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Nov 27, 2019

Overview

Minor readability cleanup part of WTF-reduction regime

Before

We see the equivalent of

if ($a or $b) {
  $x = 1;
}
elseif ($value == '0' || $value !== '') {
 $x = 2;
}
else {
  $x = 1;
}

The 2 statements in the second part overlap - ie if value == 0 is redundant & the final else only applies when $value !== ''

After

We see the equivalent of

if ($a or $b  || $value !== '') {
  $x = 1;
}
else  {
 $x = 2;
}

Technical Details

This just condenses the statement since != '' is so broad we know the final
else is only when that is true - ergo it's the same as above

Comments

This just condenses the statement since  != '' is so broad we know the final
else is only when that is true - ergo it's the same as above
@civibot
Copy link

civibot bot commented Nov 27, 2019

(Standard links)

@seamuslee001
Copy link
Contributor

Makes sense to me merging

@seamuslee001 seamuslee001 merged commit 3f0a734 into civicrm:master Dec 2, 2019
@eileenmcnaughton eileenmcnaughton deleted the ex_clean branch December 2, 2019 21:33
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.

2 participants