Use ?? operator instead of CRM_Utils_Array::value() in array assignments
[civicrm-core.git] / CRM / Price / BAO / LineItem.php
index c1f017f435a2cf04ef4b014af9a9428e2a9e1371..9c5b9bd58c0c5de7b6d4311742f958b0ea749742 100644 (file)
@@ -342,21 +342,21 @@ WHERE li.contribution_id = %1";
       $values[$oid] = [
         'price_field_id' => $fid,
         'price_field_value_id' => $oid,
-        'label' => CRM_Utils_Array::value('label', $options[$oid]),
+        'label' => $options[$oid]['label'] ?? NULL,
         'field_title' => $fieldTitle,
-        'description' => CRM_Utils_Array::value('description', $options[$oid]),
+        'description' => $options[$oid]['description'] ?? NULL,
         'qty' => $qty,
         'unit_price' => $price,
         'line_total' => $qty * $price,
         'participant_count' => $qty * $participantsPerField,
-        'max_value' => CRM_Utils_Array::value('max_value', $options[$oid]),
-        'membership_type_id' => CRM_Utils_Array::value('membership_type_id', $options[$oid]),
-        'membership_num_terms' => CRM_Utils_Array::value('membership_num_terms', $options[$oid]),
-        'auto_renew' => CRM_Utils_Array::value('auto_renew', $options[$oid]),
+        'max_value' => $options[$oid]['max_value'] ?? NULL,
+        'membership_type_id' => $options[$oid]['membership_type_id'] ?? NULL,
+        'membership_num_terms' => $options[$oid]['membership_num_terms'] ?? NULL,
+        'auto_renew' => $options[$oid]['auto_renew'] ?? NULL,
         'html_type' => $fields['html_type'],
-        'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $options[$oid]),
+        'financial_type_id' => $options[$oid]['financial_type_id'] ?? NULL,
         'tax_amount' => CRM_Utils_Array::value('tax_amount', $options[$oid], 0),
-        'non_deductible_amount' => CRM_Utils_Array::value('non_deductible_amount', $options[$oid]),
+        'non_deductible_amount' => $options[$oid]['non_deductible_amount'] ?? NULL,
       ];
 
       if ($values[$oid]['membership_type_id'] && empty($values[$oid]['auto_renew'])) {