-
-
Notifications
You must be signed in to change notification settings - Fork 824
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] Minor code cleanup #17225
[REF] Minor code cleanup #17225
Conversation
(Standard links)
|
CRM_Utils_Array::value('name', $v, '') == 'image_URL' || | ||
CRM_Utils_Array::value('field_type', $v) == 'Formatting' | ||
) { | ||
$v['data_type'] ?? '' === 'File' || $v['name'] ?? '' === 'image_URL' || $v['field_type'] === 'Formatting') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I first looked at this, I thought the precidence of the ??
operators and the ===
operators might be ambiguous and we should add parentheses.
On second look, I see that the array data is coming from CRM_Core_BAO_UFGroup::getFields
which runs every item through CRM_Core_BAO_UFGroup::formatUFField
which ensures that data_type
, name
, and field_type
keys are always present. So I don't think the coalesce is needed and this is just another historical artifact of our developers' love-affair with CRM_Utils_Array::value()
using it places where it isn't needed, "just because".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh - let's remove!
Do not pass params as reference as unchanged
CRM_Utils_Array::value('name', $v, '') == 'image_URL' || | ||
CRM_Utils_Array::value('field_type', $v) == 'Formatting' | ||
) { | ||
$v['data_type'] === 'File' || $v['name'] === 'image_URL' || $v['field_type'] === 'Formatting') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw tada
Overview
Do not pass params as reference as unchanged
Before
function takes &$params,
After
function takes $params, other minor cleanups
Technical Details
Comments