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

[REF] remove unnecessary variable variables #17903

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jul 21, 2020

Overview

For a brief but terrifying spell this arvo I delved into this function to try to understand
the purpose of 'preserveDBName'. Obviously I ran screaming from the room but I thought I could disarm these
few lines to slighly file down the fangs of the beast.

Code is heavily covered by tests

Before

$firstName = CRM_Utils_Array::value('first_name', $params, '');

...

$$fld = trim($$fld);

After

$firstName = trim($params['first_name'] ?? '');

Technical Details

Obviously this scope could creep in many directions but I'm aiming to keep trauma levels low

Comments

For a brief but terrifying spell this arvo I delved into this function to try to understand
the purpose of 'preserveDBName'. Obviously I ran screaming from the room but I thought I could disarm these
few lines to slighly file down the fangs of the beast.

Code is heavily covered by tests
@civibot
Copy link

civibot bot commented Jul 21, 2020

(Standard links)

@civibot civibot bot added the master label Jul 21, 2020
@demeritcowboy
Copy link
Contributor

Wow.

So line 116 - before the patch it might get trimmed by the removed lines lower down at 167. After the patch it wouldn't get trimmed.

Yeah.

@eileenmcnaughton
Copy link
Contributor Author

Yeah - I think we can assume trimming has occurred already on the stuff already on the DB. For more fear-filled thrils look at deceased_date handling at the end of the function

@demeritcowboy
Copy link
Contributor

$date = $date . $separator . '1902';

I don't see a suitable emoji to describe this experience.

@demeritcowboy
Copy link
Contributor

Assuming $individual->$dbName is already trimmed in the db, then the only other place is line 119 and that's already handled near the top if it was in $params. Did light r-run. 👍

@seamuslee001
Copy link
Contributor

changes look fine to me merging

@seamuslee001 seamuslee001 merged commit b2891cf into civicrm:master Jul 21, 2020
@seamuslee001 seamuslee001 deleted the format branch July 21, 2020 22:23
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.

3 participants