[Ref] Clarify what parameters are passed in #21063
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
[Ref] Clarify what parameters are passed in
this function is called from 2 places with 4 keys in the array always set & no others
Before
It's not clear in the function that these 3 values will always be NULL
Or that the keys will always be present for
which means that any changes around the assumptions for those keys will require a reviewer to do a grep.
After
By tightening the setting of values from these keys we make it so a reviewer of future cleanups won't need to look outside this function to check the values coming in.
Also assigning the name to values makes the if clauses more legible - which will make it easier to point out the chunks of this code are unreachable in follow ups :-)
Technical Details
These are the 2 places that call the function and in both places exactly the same 4 keys are set
Comments
Obviously it's a given that external code should not be calling this function - in universe I find no examples (I do find a couple of references to a function that used to exist and used to call this function & I logged an issue against the relevant extension)