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

Squash 2 if clauses into 1 #19190

Merged
merged 1 commit into from
Dec 13, 2020
Merged

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Very minor code tidy up - The action is the same for both criteria so in_array rather than 2 * if =
makes it more readable

Before

pattern be like

if ($animal == 'dog) {
  stroke();
elseif($animail === 'cat') {
  stroke();
}

After

pattern be like

if (in_array($animal, ['cat', 'dog'], TRUE)) {
  stroke();
}

Technical Details

Comments

The action is the same for both criteria so in_array rather than 2 * if =
makes it more readable
@civibot
Copy link

civibot bot commented Dec 12, 2020

(Standard links)

@civibot civibot bot added the master label Dec 12, 2020
@eileenmcnaughton
Copy link
Contributor Author

test this please

@seamuslee001
Copy link
Contributor

Makes sense to me merging

@seamuslee001 seamuslee001 merged commit 5c347c3 into civicrm:master Dec 13, 2020
@seamuslee001 seamuslee001 deleted the import22 branch December 13, 2020 03:14
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