PHP 7.4 - Simplify expressions with null coalescing assignment operator
authorcolemanw <coleman@civicrm.org>
Wed, 13 Dec 2023 00:54:26 +0000 (19:54 -0500)
committercolemanw <coleman@civicrm.org>
Wed, 13 Dec 2023 16:50:18 +0000 (11:50 -0500)
109 files changed:
CRM/ACL/Form/ACL.php
CRM/Activity/Form/ActivityView.php
CRM/Admin/Form/MailSettings.php
CRM/Admin/Form/RelationshipType.php
CRM/Badge/BAO/Layout.php
CRM/Batch/BAO/Batch.php
CRM/Batch/Form/Entry.php
CRM/Campaign/Form/Campaign.php
CRM/Campaign/Form/Petition.php
CRM/Campaign/Form/Survey/Main.php
CRM/Case/Form/Activity/ChangeCaseStartDate.php
CRM/Contact/BAO/Contact/Permission.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/SavedSearch.php
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Inline/CommunicationPreferences.php
CRM/Contact/Form/Search.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionRecur.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionPage/Premium.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Contribute/Form/ContributionPage/ThankYou.php
CRM/Contribute/Form/ContributionPage/Widget.php
CRM/Contribute/WorkflowMessage/Contribution/BasicContribution.php
CRM/Core/Action.php
CRM/Core/BAO/ActionLog.php
CRM/Core/BAO/CustomGroup.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/BAO/MailSettings.php
CRM/Core/BAO/Navigation.php
CRM/Core/BAO/OptionValue.php
CRM/Core/BAO/StatusPreference.php
CRM/Core/BAO/Tag.php
CRM/Core/CodeGen/Specification.php
CRM/Core/DAO.php
CRM/Core/EntityTokens.php
CRM/Core/Form.php
CRM/Core/OptionValue.php
CRM/Core/Payment/Form.php
CRM/Core/Resources/CollectionTrait.php
CRM/Custom/Page/Group.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Event.php
CRM/Event/Form/ManageEvent/EventInfo.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Event/Form/ManageEvent/Registration.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/Register.php
CRM/Financial/BAO/Order.php
CRM/Financial/BAO/Payment.php
CRM/Financial/Form/FinancialAccount.php
CRM/Financial/Form/FinancialType.php
CRM/Group/Form/Edit.php
CRM/Import/Parser.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/Query.php
CRM/Member/BAO/Membership.php
CRM/PCP/BAO/PCP.php
CRM/PCP/Form/Contribute.php
CRM/PCP/Form/Event.php
CRM/Price/BAO/PriceSet.php
CRM/Price/Form/Field.php
CRM/Price/Form/Option.php
CRM/Price/Form/Set.php
CRM/Price/Page/Option.php
CRM/Report/BAO/ReportInstance.php
CRM/Report/Form.php
CRM/Report/Form/ActivitySummary.php
CRM/Report/Form/Contact/Detail.php
CRM/Report/Form/Contribute/DeferredRevenue.php
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Report/Form/Event/Income.php
CRM/Report/Form/Instance.php
CRM/SMS/Form/Provider.php
CRM/UF/Form/Field.php
CRM/Utils/Hook.php
CRM/Utils/Money.php
CRM/Utils/Recent.php
CRM/Utils/System.php
Civi/API/Subscriber/DebugSubscriber.php
Civi/Api4/Generic/AutocompleteAction.php
Civi/Api4/Generic/BasicGetFieldsAction.php
Civi/Api4/Service/Spec/Provider/MailingGetSpecProvider.php
Civi/Api4/Utils/CoreUtil.php
Civi/Payment/PropertyBag.php
api/v3/Contribution.php
api/v3/Generic.php
api/v3/LocBlock.php
api/v3/Mailing.php
api/v3/Order.php
api/v3/Profile.php
ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php
ext/afform/core/afform.php
ext/afform/mock/tests/phpunit/Civi/AfformMock/FormTestCase.php
ext/authx/Civi/Authx/Authenticator.php
ext/oauth-client/Civi/OAuth/OAuthLeagueFacade.php
ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php
ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php
ext/standaloneusers/Civi/Standalone/Security.php
tests/extensions/test.extension.manager.paymenttest/main.php
tests/phpunit/CRM/Core/CopyTest.php
tests/phpunit/CRM/Member/BAO/MembershipLogTest.php
tests/phpunit/CRM/Utils/TokenConsistencyTest.php
tests/phpunit/api/v4/Request/AjaxTest.php
tools/mixin/src/Mixlib.php

index 5f5c5b88a5e254b42f0149e8a4c5009519c1e68a..2a2293b1eeea0e3088549c91881af591ca22c87e 100644 (file)
@@ -256,7 +256,7 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form {
     }
     else {
       $params = $this->controller->exportValues($this->_name);
-      $params['is_active'] = $params['is_active'] ?? FALSE;
+      $params['is_active'] ??= FALSE;
       $params['entity_table'] = 'civicrm_acl_role';
 
       // Figure out which type of object we're permissioning on and set object_table and object_id.
index e5223a6f1276fe0faad9ade150ad2beb11e0655a..27d7136176a89f6d3d9fd61c400420264678e35f 100644 (file)
@@ -88,11 +88,11 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
     }
 
     // ensure these are set so that they get assigned to the template
-    $values['mailingId'] = $values['mailingId'] ?? NULL;
-    $values['campaign'] = $values['campaign'] ?? NULL;
-    $values['engagement_level'] = $values['engagement_level'] ?? NULL;
+    $values['mailingId'] ??= NULL;
+    $values['campaign'] ??= NULL;
+    $values['engagement_level'] ??= NULL;
     // also this which doesn't get set for bulk emails
-    $values['target_contact_value'] = $values['target_contact_value'] ?? NULL;
+    $values['target_contact_value'] ??= NULL;
 
     // Get the campaign.
     $campaignId = $defaults['campaign_id'] ?? NULL;
index 833c0de1375378f8488bf488b56d1f6f23cc36a6..6866c431d97948d19e8bbd6c085fc6b3ef787ec1 100644 (file)
@@ -126,15 +126,15 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form {
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
 
-    $defaults['is_ssl'] = $defaults['is_ssl'] ?? TRUE;
-    $defaults['is_default'] = $defaults['is_default'] ?? 0;
+    $defaults['is_ssl'] ??= TRUE;
+    $defaults['is_default'] ??= 0;
     $defaults['activity_type_id'] = $defaults['activity_type_id'] ??
       CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Inbound Email');
-    $defaults['activity_status'] = $defaults['activity_status'] ?? 'Completed';
-    $defaults['activity_source'] = $defaults['activity_source'] ?? 'from';
-    $defaults['activity_targets'] = $defaults['activity_targets'] ?? 'to,cc,bcc';
-    $defaults['activity_assignees'] = $defaults['activity_assignees'] ?? 'from';
-    $defaults['is_active'] = $defaults['is_active'] ?? TRUE;
+    $defaults['activity_status'] ??= 'Completed';
+    $defaults['activity_source'] ??= 'from';
+    $defaults['activity_targets'] ??= 'to,cc,bcc';
+    $defaults['activity_assignees'] ??= 'from';
+    $defaults['is_active'] ??= TRUE;
 
     return $defaults;
   }
index c3c07573ddc3ad4bda7d3f8157b726cdcbf522a1..83c4dd2b9447666e49735c2e6ca2e85e9859c383 100644 (file)
@@ -141,7 +141,7 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
     else {
       // store the submitted values in an array
       $params = $this->exportValues();
-      $params['is_active'] = $params['is_active'] ?? FALSE;
+      $params['is_active'] ??= FALSE;
 
       if ($this->_action & CRM_Core_Action::UPDATE) {
         $params['id'] = $this->_id;
index e7443c3ef43fa951b67644b81f31a206815753c0..b4148684752699f95b636b64508fc54b6d7a4117 100644 (file)
@@ -50,9 +50,9 @@ class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel {
    * @return object
    */
   public static function create(&$params) {
-    $params['is_active'] = $params['is_active'] ?? FALSE;
-    $params['is_default'] = $params['is_default'] ?? FALSE;
-    $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
+    $params['is_active'] ??= FALSE;
+    $params['is_default'] ??= FALSE;
+    $params['is_reserved'] ??= FALSE;
 
     $params['label_type_id'] = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_PrintLabel', 'label_type_id', 'Event Badge');
 
index 100a4e93761444006486446eee4740d72e3ced13..86a858388a7990b6f852207f3fc543869648b300 100644 (file)
@@ -73,7 +73,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch implements \Civi\Core\Hook
    * @deprecated
    */
   public static function retrieve(array $params, ?array &$defaults = NULL) {
-    $defaults = $defaults ?? [];
+    $defaults ??= [];
     return self::commonRetrieve(self::class, $params, $defaults);
   }
 
index 7a472a9fe1e148b5e56d975a71b23fbb8c3feab7..01b40c1da86ac5091bf2dac66341930acf884d23 100644 (file)
@@ -1162,7 +1162,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
     }
 
     // The latter format would be normal here - it's unclear if it is sometimes in the former format.
-    $row['membership_type_id'] = $row['membership_type_id'] ?? $row['membership_type'][1];
+    $row['membership_type_id'] ??= $row['membership_type'][1];
     unset($row['membership_type']);
     // total_amount is required.
     $row['total_amount'] = (float) $row['total_amount'];
index f5a1c523bb414b93f956c472909f887a4f53f02d..441033281d9a72001d73b6624e3f8b43a0eecaa6 100644 (file)
@@ -291,7 +291,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
       $params['created_date'] = date('YmdHis');
     }
     // format params
-    $params['is_active'] = $params['is_active'] ?? FALSE;
+    $params['is_active'] ??= FALSE;
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
     $result = self::submit($params, $this);
index 55a7377984fa17542d2bc152ad418670304d71c1..c12a653c1d371886f58a10bd43e4508334a9b48f 100644 (file)
@@ -291,7 +291,7 @@ WHERE  $whereClause
 
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
-    $params['is_share'] = $params['is_share'] ?? FALSE;
+    $params['is_share'] ??= FALSE;
 
     if ($this->_surveyId) {
 
@@ -309,9 +309,9 @@ WHERE  $whereClause
       $params['created_date'] = date('YmdHis');
     }
 
-    $params['bypass_confirm'] = $params['bypass_confirm'] ?? 0;
-    $params['is_active'] = $params['is_active'] ?? 0;
-    $params['is_default'] = $params['is_default'] ?? 0;
+    $params['bypass_confirm'] ??= 0;
+    $params['is_active'] ??= 0;
+    $params['is_default'] ??= 0;
 
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
 
index e23617951bf24bcd9236a67b9f360dadd1b26476..88aa3c9eb56a9b5697385dd995ae4957fc3643b5 100644 (file)
@@ -155,8 +155,8 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
       $params['created_date'] = date('YmdHis');
     }
 
-    $params['is_active'] = $params['is_active'] ?? 0;
-    $params['is_default'] = $params['is_default'] ?? 0;
+    $params['is_active'] ??= 0;
+    $params['is_default'] ??= 0;
 
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->getEntityId(), $this->getDefaultEntity());
 
index 4ea98a4f771ce2cdfd1dd0b39d6c24deeec2d70c..1a62ae2c90c54de6e707109231b541e57e98c23c 100644 (file)
@@ -186,7 +186,7 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
 
       // @todo This can go eventually but is still needed to keep them linked together if there is an existing revision. Just focusing right now on not creating new revisions.
       // original_id always refers to the first activity, so if it's null or missing, then it means no previous revisions and we can keep it null.
-      $openCaseParams['original_id'] = $openCaseParams['original_id'] ?? NULL;
+      $openCaseParams['original_id'] ??= NULL;
 
       $newActivity = CRM_Activity_BAO_Activity::create($openCaseParams);
       if (is_a($newActivity, 'CRM_Core_Error')) {
index 1deec754ac3943c2a8adab4b7778a86871795bc0..db3ff979f13b63736a2014f13b7ac385fa4fb2ce 100644 (file)
@@ -151,7 +151,7 @@ WHERE contact_id IN ({$contact_id_list})
    */
   public static function allow($id, $type = CRM_Core_Permission::VIEW, $userID = NULL) {
     // Default to logged in user if not supplied
-    $userID = $userID ?? CRM_Core_Session::getLoggedInContactID();
+    $userID ??= CRM_Core_Session::getLoggedInContactID();
 
     // first: check if contact is trying to view own contact
     if ($userID == $id && ($type == CRM_Core_Permission::VIEW && CRM_Core_Permission::check('view my contact')
@@ -389,7 +389,7 @@ AND    $operationClause
     }
 
     // Default to currently logged in user
-    $userID = $userID ?? CRM_Core_Session::getLoggedInContactID();
+    $userID ??= CRM_Core_Session::getLoggedInContactID();
     if (empty($userID)) {
       return [];
     }
index 6855885fdd1bdc686d3882b8a5ef15201a0e536c..b4b6ff3d366a5819345722f19555d3fd66eba7a9 100644 (file)
@@ -5344,7 +5344,7 @@ civicrm_relationship.start_date > {$today}
       }
 
       if ($secondDate) {
-        $highDBFieldName = $highDBFieldName ?? $dbFieldName;
+        $highDBFieldName ??= $dbFieldName;
         $this->_where[$grouping][] = "
 ( {$tableName}.{$dbFieldName} $firstOP '$firstDate' ) AND
 ( {$tableName}.{$highDBFieldName} $secondOP '$secondDate' )
@@ -5398,8 +5398,8 @@ civicrm_relationship.start_date > {$today}
     }
 
     // Ensure the tables are set, but don't whomp anything.
-    $this->_tables[$tableName] = $this->_tables[$tableName] ?? 1;
-    $this->_whereTables[$tableName] = $this->_whereTables[$tableName] ?? 1;
+    $this->_tables[$tableName] ??= 1;
+    $this->_whereTables[$tableName] ??= 1;
   }
 
   /**
@@ -7056,8 +7056,8 @@ AND   displayRelType.is_active = 1
     $filters = CRM_Core_OptionGroup::values('relative_date_filters');
     $grouping = $values[3] ?? NULL;
     // If the table value is already set for a custom field it will be more nuanced than just '1'.
-    $this->_tables[$tableName] = $this->_tables[$tableName] ?? 1;
-    $this->_whereTables[$tableName] = $this->_whereTables[$tableName] ?? 1;
+    $this->_tables[$tableName] ??= 1;
+    $this->_whereTables[$tableName] ??= 1;
 
     $dates = CRM_Utils_Date::getFromTo($value, NULL, NULL);
     // Where end would be populated only if we are handling one of the weird ones with different from & to fields.
index a5f801dcc0b96ab780249728384c02bb2872e091..bb7b939a48bdb0db43ebbbfca07275c61361809f 100644 (file)
@@ -250,9 +250,9 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch implements
       $loggedInContactID = CRM_Core_Session::getLoggedInContactID();
       if ($loggedInContactID) {
         if ($event->action === 'create') {
-          $event->params['created_id'] = $event->params['created_id'] ?? $loggedInContactID;
+          $event->params['created_id'] ??= $loggedInContactID;
         }
-        $event->params['modified_id'] = $event->params['modified_id'] ?? $loggedInContactID;
+        $event->params['modified_id'] ??= $loggedInContactID;
       }
       // Set by mysql
       unset($event->params['modified_date']);
index 8bfc19f3773047df6efc14cc2f1f498175aaa927..d94fbd29406d3319ddf9dd141e484c6ae42fd861 100644 (file)
@@ -1055,7 +1055,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
     if (array_key_exists('CommunicationPreferences', $this->_editOptions)) {
       // this is a chekbox, so mark false if we dont get a POST value
-      $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
+      $params['is_opt_out'] ??= FALSE;
 
       CRM_Utils_Array::formatArrayKeys($params['preferred_communication_method']);
     }
index f65942b56ffeee3d628f8ebc86af4274cb28d92b..ec2b48dae4526c587dc7f5342a9ff7f3544ae288 100644 (file)
@@ -65,7 +65,7 @@ class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Contact_Form_
     // Process / save communication preferences
 
     // this is a chekbox, so mark false if we dont get a POST value
-    $params['is_opt_out'] = $params['is_opt_out'] ?? FALSE;
+    $params['is_opt_out'] ??= FALSE;
     $params['contact_type'] = $this->_contactType;
     $params['contact_id'] = $this->_contactId;
 
index ac69d0ce9b155b34b13abca4e26df6f608d64cc0..26ea1f2cbf9cbe45154fa23a51d82576fd9663fa 100644 (file)
@@ -766,7 +766,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
 
     //get the button name
     $buttonName = $this->controller->getButtonName();
-    $this->_formValues['uf_group_id'] = $this->_formValues['uf_group_id'] ?? $this->get('uf_group_id');
+    $this->_formValues['uf_group_id'] ??= $this->get('uf_group_id');
 
     if (isset($this->_componentMode) && empty($this->_formValues['component_mode'])) {
       $this->_formValues['component_mode'] = $this->_componentMode;
index c1bb81b39ed85587bde4a1b942e377d1a0bc9d3f..376c9b8ecc20367364fd647bb74ddd3054783c30 100644 (file)
@@ -2244,7 +2244,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
       }
     }
 
-    $contributionParams['source'] = $contributionParams['source'] ?? ts('Recurring contribution');
+    $contributionParams['source'] ??= ts('Recurring contribution');
 
     $createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
     $temporaryObject = new CRM_Contribute_BAO_Contribution();
index c2b914b43ec0a16e19eae4563e8577a4841ca952..e38b7c937f76ef437e4d1c47c26f1c3ddc382eb0 100644 (file)
@@ -504,7 +504,7 @@ INNER JOIN civicrm_contribution       con ON ( con.id = mp.contribution_id )
       $templateContributionParams['on_behalf'] = TRUE;
       $templateContributionParams['source_contact_id'] = $relatedContact['individual_id'];
     }
-    $templateContributionParams['source'] = $templateContributionParams['source'] ?? ts('Recurring contribution');
+    $templateContributionParams['source'] ??= ts('Recurring contribution');
     $templateContribution = Contribution::create(FALSE)
       ->setValues($templateContributionParams)
       ->execute()
index 8a343718bb9003c59ce72177237c0139417c38ee..47c93e835fdad7b3cbe380a0240d9764ed807806 100644 (file)
@@ -947,7 +947,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $form->_priceSet = $priceSet[$priceSetId] ?? NULL;
     $validPriceFieldIds = array_keys($form->_priceSet['fields']);
 
-    $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetId;
+    $form->_priceSet['id'] ??= $priceSetId;
     $form->assign('priceSet', $form->_priceSet);
 
     $feeBlock = &$form->_priceSet['fields'];
index 306a6ab2af9b9d19a3f90be4e7739b2daa2c3a7f..cb33e31be76593cb112042cbb3b009b72b54ebe8 100644 (file)
@@ -1162,8 +1162,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
         ->addWhere('id', '=', $selectedMembershipTypeID)
         ->execute()
         ->first();
-      $this->_params['frequency_interval'] = $this->_params['frequency_interval'] ?? $this->_values['fee'][$priceFieldId]['options'][$priceFieldValue]['membership_num_terms'];
-      $this->_params['frequency_unit'] = $this->_params['frequency_unit'] ?? $membershipTypeDetails['duration_unit'];
+      $this->_params['frequency_interval'] ??= $this->_values['fee'][$priceFieldId]['options'][$priceFieldValue]['membership_num_terms'];
+      $this->_params['frequency_unit'] ??= $membershipTypeDetails['duration_unit'];
     }
     elseif (!$this->_separateMembershipPayment && (in_array($selectedMembershipTypeID, $membershipTypes['autorenew_required'])
       || in_array($selectedMembershipTypeID, $membershipTypes['autorenew_optional']))) {
index 03092f75e7b8e943b2d2995a354325eeb9eda1e0..bd3ec811d1f532c60bfd5ed57667172e5633b22c 100644 (file)
@@ -494,8 +494,8 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
       $params['recur_frequency_unit'] = implode(CRM_Core_DAO::VALUE_SEPARATOR,
         array_keys($params['recur_frequency_unit'])
       );
-      $params['is_recur_interval'] = $params['is_recur_interval'] ?? FALSE;
-      $params['is_recur_installments'] = $params['is_recur_installments'] ?? FALSE;
+      $params['is_recur_interval'] ??= FALSE;
+      $params['is_recur_installments'] ??= FALSE;
     }
 
     if (!empty($params['adjust_recur_start_date'])) {
index 53cde454f247f4df8e0ffc570952a0a1dfd942d6..cd4e6f82ed927f0cc0bdc70144e765f902e48f21 100644 (file)
@@ -113,8 +113,8 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C
       $params['id'] = $premiumID;
     }
 
-    $params['premiums_active'] = $params['premiums_active'] ?? FALSE;
-    $params['premiums_display_min_contribution'] = $params['premiums_display_min_contribution'] ?? FALSE;
+    $params['premiums_active'] ??= FALSE;
+    $params['premiums_display_min_contribution'] ??= FALSE;
     $params['entity_table'] = 'civicrm_contribution_page';
     $params['entity_id'] = $this->_id;
 
index a91499ab6a5ff2846451087dacba027f909ee1c2..bff9904089ce592abd73734b8725d302c7b5d4f4 100644 (file)
@@ -311,11 +311,11 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
       $params['currency'] = $config->defaultCurrency;
     }
 
-    $params['is_confirm_enabled'] = $params['is_confirm_enabled'] ?? FALSE;
-    $params['is_share'] = $params['is_share'] ?? FALSE;
-    $params['is_active'] = $params['is_active'] ?? FALSE;
-    $params['is_credit_card_only'] = $params['is_credit_card_only'] ?? FALSE;
-    $params['honor_block_is_active'] = $params['honor_block_is_active'] ?? FALSE;
+    $params['is_confirm_enabled'] ??= FALSE;
+    $params['is_share'] ??= FALSE;
+    $params['is_active'] ??= FALSE;
+    $params['is_credit_card_only'] ??= FALSE;
+    $params['honor_block_is_active'] ??= FALSE;
     $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
     $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
 
index 2b325bc60b61234b6790217ed52a57d5c71b2c1c..74da49804a74b81a44c540dad453e42970306d86 100644 (file)
@@ -100,7 +100,7 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_
     $params = $this->controller->exportValues($this->_name);
 
     $params['id'] = $this->_id;
-    $params['is_email_receipt'] = $params['is_email_receipt'] ?? FALSE;
+    $params['is_email_receipt'] ??= FALSE;
     if (!$params['is_email_receipt']) {
       $params['receipt_from_name'] = NULL;
       $params['receipt_from_email'] = NULL;
index 4cb6185c82079a6826b704b6a25b9a27ca1f66ad..2f60fd96ddb4cd870222ef027691b1bbcab7981f 100644 (file)
@@ -267,7 +267,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
       $params['id'] = $this->_widget->id;
     }
     $params['contribution_page_id'] = $this->_id;
-    $params['is_active'] = $params['is_active'] ?? FALSE;
+    $params['is_active'] ??= FALSE;
     $params['url_homepage'] = 'null';
 
     $widget = new CRM_Contribute_DAO_Widget();
index d2610b6a4f4e19dcfbb223e7a590d63fcf597189..a961e80a110772039c225a51ed30ee5e2fed9b42 100644 (file)
@@ -119,7 +119,7 @@ class CRM_Contribute_WorkflowMessage_Contribution_BasicContribution extends Work
   private function addExampleData(GenericWorkflowMessage $messageTemplate, $example): void {
     $messageTemplate->setContact(Test::example('entity/Contact/Barb'));
     $contribution = Test::example('entity/Contribution/Euro5990/completed');
-    $example['currency'] = $example['currency'] ?? \Civi::settings()->get('defaultCurrency');
+    $example['currency'] ??= \Civi::settings()->get('defaultCurrency');
     if (isset($example['contribution_params'])) {
       $contribution = array_merge($contribution, $example['contribution_params']);
     }
index eed5724a99fecb2335f497c717f1c5f976880a71..3adae016f68bda74ceb1adee9576449d8bbb232f 100644 (file)
@@ -79,7 +79,7 @@ class CRM_Core_Action {
   ];
 
   private static function getInfo(): array {
-    Civi::$statics[__CLASS__ . 'Info'] = Civi::$statics[__CLASS__ . 'Info'] ?? [
+    Civi::$statics[__CLASS__ . 'Info'] ??= [
       self::ADD => [
         'name' => 'add',
         'label' => ts('Add'),
index 7d447fa417dcdc08fb453993915c812de84b38c4..5efcc5a73066439c7ac77cb59b1a45a5cda08688 100644 (file)
@@ -29,7 +29,7 @@ class CRM_Core_BAO_ActionLog extends CRM_Core_DAO_ActionLog {
    */
   public static function create($params) {
     if (empty($params['id'])) {
-      $params['action_date_time'] = $params['action_date_time'] ?? date('YmdHis');
+      $params['action_date_time'] ??= date('YmdHis');
     }
 
     return self::writeRecord($params);
index c9ea430fc5b35e6cce30e9eee6e7fb827b5819da..e6941666d8c5fa15b4d34632394a6a3ac14bf2ab 100644 (file)
@@ -2558,7 +2558,7 @@ SELECT  civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
       ];
     }
     foreach ($options as &$option) {
-      $option['icon'] = $option['icon'] ?? \Civi\Api4\Utils\CoreUtil::getInfoItem($option['id'], 'icon');
+      $option['icon'] ??= \Civi\Api4\Utils\CoreUtil::getInfoItem($option['id'], 'icon');
     }
     return $options;
   }
index c448d3ce2b4d7e68cc3133a1ac924c684de9186e..bdec58cb3fb0ee4cd0f429493b347175702fb396 100644 (file)
@@ -396,8 +396,8 @@ class CRM_Core_BAO_CustomQuery {
   protected function joinCustomTableForField($field) {
     $name = $field['table_name'];
     $join = "\nLEFT JOIN $name ON $name.entity_id = {$field['search_table']}.id";
-    $this->_tables[$name] = $this->_tables[$name] ?? $join;
-    $this->_whereTables[$name] = $this->_whereTables[$name] ?? $join;
+    $this->_tables[$name] ??= $join;
+    $this->_whereTables[$name] ??= $join;
 
     $joinTable = $field['search_table'];
     if ($joinTable) {
index 2d8b6b85ef6dcf70fcdff09bc7755f9a829800c5..53a719272e151ed56a705c304e8a306b3650c487 100644 (file)
@@ -136,8 +136,8 @@ class CRM_Core_BAO_MailSettings extends CRM_Core_DAO_MailSettings {
     }
 
     if (empty($params['id'])) {
-      $params['is_ssl'] = $params['is_ssl'] ?? FALSE;
-      $params['is_default'] = $params['is_default'] ?? FALSE;
+      $params['is_ssl'] ??= FALSE;
+      $params['is_default'] ??= FALSE;
     }
 
     //handle is_default.
index 9a5bb862a260db8c05fbd490df3f5890b1d0f167..69774eefdd4725f11eb55b3be4b2c0e039195e39 100644 (file)
@@ -75,8 +75,8 @@ class CRM_Core_BAO_Navigation extends CRM_Core_DAO_Navigation {
    */
   public static function add(&$params) {
     if (empty($params['id'])) {
-      $params['is_active'] = $params['is_active'] ?? FALSE;
-      $params['has_separator'] = $params['has_separator'] ?? FALSE;
+      $params['is_active'] ??= FALSE;
+      $params['has_separator'] ??= FALSE;
       $params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
     }
 
index a7d3c2562d274884fb22afddc596d4c7b63244e7..1fb48d51b8a452bcb997c70e08a8cc89b494ac16 100644 (file)
@@ -48,10 +48,10 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue implements \Civi
    * @param array $params
    */
   public static function setDefaults(&$params) {
-    $params['label'] = $params['label'] ?? $params['name'];
-    $params['name'] = $params['name'] ?? CRM_Utils_String::titleToVar($params['label']);
-    $params['weight'] = $params['weight'] ?? self::getDefaultWeight($params);
-    $params['value'] = $params['value'] ?? self::getDefaultValue($params);
+    $params['label'] ??= $params['name'];
+    $params['name'] ??= CRM_Utils_String::titleToVar($params['label']);
+    $params['weight'] ??= self::getDefaultWeight($params);
+    $params['value'] ??= self::getDefaultValue($params);
   }
 
   /**
index 044a538d046c5780fc4a75c5e63a03abdc6e8f43..032dedde1bd507d6a4627b921199bdb17f0d4ac2 100644 (file)
@@ -31,7 +31,7 @@ class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference {
     $statusPreference = new CRM_Core_DAO_StatusPreference();
 
     // Default severity level to ignore is 0 (DEBUG).
-    $params['ignore_severity'] = $params['ignore_severity'] ?? 0;
+    $params['ignore_severity'] ??= 0;
 
     // Severity can be either text ('critical') or an integer <= 7.
     // It's a magic number, but based on PSR-3 standards.
index 2e57b46f72996328437382fc55f31046f5fd8e22..5ea9ea897c0871b2a405c832e91df02ca84e1903 100644 (file)
@@ -413,7 +413,7 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
 
     // save creator id and time
     if (!$id) {
-      $params['created_id'] = $params['created_id'] ?? CRM_Core_Session::getLoggedInContactID();
+      $params['created_id'] ??= CRM_Core_Session::getLoggedInContactID();
     }
 
     $tag = self::writeRecord($params);
index 24013d7257408cbf30ed58d446be1db43572d3d7..a6e66212a4345cca1607af3f42e95a89c241f547 100644 (file)
@@ -391,7 +391,7 @@ class CRM_Core_CodeGen_Specification {
     $field['usage'] = array_merge(array_fill_keys(['import', 'export', 'duplicate_matching'], $import), $usage);
     // Usage for tokens has not historically been in the metadata so we can default to FALSE.
     // historically hard-coded lists have been used.
-    $field['usage']['token'] = $field['usage']['token'] ?? 'FALSE';
+    $field['usage']['token'] ??= 'FALSE';
     $field['import'] = $field['usage']['import'];
     $field['export'] = $export ?? $import;
     $field['rule'] = $this->value('rule', $fieldXML);
index 679e1e2c1428d21fa2dd6e1edaca6433a9153a04..bb6fcada9f7d138a0f764bc9d34ff62fb2079362 100644 (file)
@@ -1432,7 +1432,7 @@ LIKE %1
       throw new CRM_Core_Exception('getFieldValue failed');
     }
 
-    self::$_dbColumnValueCache = self::$_dbColumnValueCache ?? [];
+    self::$_dbColumnValueCache ??= [];
 
     while (strpos($daoName, '_BAO_') !== FALSE) {
       $daoName = get_parent_class($daoName);
@@ -3186,8 +3186,8 @@ SELECT contact_id
    */
   public static function getSelectWhereClause($tableAlias = NULL, $entityName = NULL, $conditions = []) {
     $bao = new static();
-    $tableAlias = $tableAlias ?? $bao->tableName();
-    $entityName = $entityName ?? CRM_Core_DAO_AllCoreTables::getBriefName(get_class($bao));
+    $tableAlias ??= $bao->tableName();
+    $entityName ??= CRM_Core_DAO_AllCoreTables::getBriefName(get_class($bao));
     $finalClauses = [];
     $fields = static::getSupportedFields();
     $selectWhereClauses = $bao->addSelectWhereClause($entityName, NULL, $conditions);
index e038dc49d570e134ec7dc91e7a699345e7b47285..88d5cc2de2d15fc910f5c8da6c6ef21e7239c221 100644 (file)
@@ -641,7 +641,7 @@ class CRM_Core_EntityTokens extends AbstractTokenSubscriber {
     if ($field['type'] !== 'Custom' && !$isExposed) {
       return;
     }
-    $field['audience'] = $field['audience'] ?? 'user';
+    $field['audience'] ??= 'user';
     if ($field['name'] === 'contact_id') {
       // Since {contact.id} is almost always present don't confuse users
       // by also adding (e.g {participant.contact_id)
index c24a0208373481717cb9641b1831fc3b5033f977..5323fe2daaed45861ca69d02c74541da0038ae5b 100644 (file)
@@ -535,7 +535,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
       $attributes['data-crm-datepicker'] = json_encode((array) $extra);
       if (!empty($attributes['aria-label']) || $label) {
-        $attributes['aria-label'] = $attributes['aria-label'] ?? $label;
+        $attributes['aria-label'] ??= $label;
       }
       $type = 'text';
     }
@@ -1114,7 +1114,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   protected function handlePreApproval(&$params) {
     try {
       $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
-      $params['component'] = $params['component'] ?? 'contribute';
+      $params['component'] ??= 'contribute';
       $result = $payment->doPreApproval($params);
       if (empty($result)) {
         // This could happen, for example, when paypal looks at the button value & decides it is not paypal express.
@@ -1426,7 +1426,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         }
       }
       // We use a class here to avoid html5 issues with collapsed cutsomfield sets.
-      $optAttributes['class'] = $optAttributes['class'] ?? '';
+      $optAttributes['class'] ??= '';
       if ($required) {
         $optAttributes['class'] .= ' required';
       }
@@ -1856,7 +1856,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       }
       if ($context == 'search') {
         $widget = $widget == 'Select2' ? $widget : 'Select';
-        $props['multiple'] = $props['multiple'] ?? TRUE;
+        $props['multiple'] ??= TRUE;
       }
       elseif (!empty($fieldSpec['serialize'])) {
         $props['multiple'] = TRUE;
@@ -1894,7 +1894,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       case 'Number':
       case 'Email':
         //TODO: Autodetect ranges
-        $props['size'] = $props['size'] ?? 60;
+        $props['size'] ??= 60;
         return $this->add(strtolower($widget), $name, $label, $props, $required);
 
       case 'hidden':
@@ -1902,8 +1902,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
       case 'TextArea':
         //Set default columns and rows for textarea.
-        $props['rows'] = $props['rows'] ?? 4;
-        $props['cols'] = $props['cols'] ?? 60;
+        $props['rows'] ??= 4;
+        $props['cols'] ??= 60;
         if (empty($props['maxlength']) && isset($fieldSpec['length'])) {
           $props['maxlength'] = $fieldSpec['length'];
         }
@@ -1988,7 +1988,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         return $this->addEntityRef($name, $label, $props, $required);
 
       case 'Password':
-        $props['size'] = $props['size'] ?? 60;
+        $props['size'] ??= 60;
         return $this->add('password', $name, $label, $props, $required);
 
       // Check datatypes of fields
@@ -2332,7 +2332,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $props['api']['fieldName'] = $this->getDefaultEntity() . '.' . $name;
     }
     $props['class'] = ltrim(($props['class'] ?? '') . ' crm-form-autocomplete');
-    $props['placeholder'] = $props['placeholder'] ?? self::selectOrAnyPlaceholder($props, $required);
+    $props['placeholder'] ??= self::selectOrAnyPlaceholder($props, $required);
     $props['data-select-params'] = json_encode($props['select']);
     $props['data-api-params'] = json_encode($props['api']);
     $props['data-api-entity'] = $props['entity'];
@@ -2372,7 +2372,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       unset($props['create']);
     }
 
-    $props['placeholder'] = $props['placeholder'] ?? self::selectOrAnyPlaceholder($props, $required);
+    $props['placeholder'] ??= self::selectOrAnyPlaceholder($props, $required);
 
     $defaults = [];
     if (!empty($props['multiple'])) {
index 2ce77fe815199227cc6e45c0de05166775747d1f..da1e4e20d0c2ff1b8b912c082095161d40415893 100644 (file)
@@ -181,7 +181,7 @@ class CRM_Core_OptionValue {
    *
    */
   public static function addOptionValue(&$params, $optionGroupName, $action, $optionValueID) {
-    $params['is_active'] = $params['is_active'] ?? FALSE;
+    $params['is_active'] ??= FALSE;
     // checking if the group name with the given id or name (in $groupParams) exists
     $groupParams = ['name' => $optionGroupName, 'is_active' => 1];
     $optionGroup = CRM_Core_BAO_OptionGroup::retrieve($groupParams, $defaults);
index 954cb96169dfd9295274d7cf2ca4ec2c41bdbfa5..8d515476d43940108bacdd6b0626565f2d6826d6 100644 (file)
@@ -97,7 +97,7 @@ class CRM_Core_Payment_Form {
   protected static function addCommonFields(&$form, $paymentFields) {
     $requiredPaymentFields = $paymentFieldsMetadata = [];
     foreach ($paymentFields as $name => $field) {
-      $field['extra'] = $field['extra'] ?? NULL;
+      $field['extra'] ??= NULL;
       if ($field['htmlType'] == 'chainSelect') {
         $form->addChainSelect($field['name'], ['required' => FALSE]);
       }
index 15daa1813fa9261370637a5747444c03d5212b30..2522980e824ba6cd5c0c2723e2afa827da69f6fe 100644 (file)
@@ -111,7 +111,7 @@ trait CRM_Core_Resources_CollectionTrait {
       $res = Civi::resources();
       list ($ext, $file) = $snippet['scriptFile'];
 
-      $snippet['translate'] = $snippet['translate'] ?? TRUE;
+      $snippet['translate'] ??= TRUE;
       if ($snippet['translate']) {
         $domain = ($snippet['translate'] === TRUE) ? $ext : $snippet['translate'];
         // Is this too early?
index 231d6fea62fe80c2def4e2ca4dabc34628f03325..7cc30efb0584a170c34e730ce471a13383a60946 100644 (file)
@@ -136,7 +136,7 @@ class CRM_Custom_Page_Group extends CRM_Core_Page {
         $customGroups[$id]['style_display'] = $customGroupStyle[$customGroups[$id]['style']];
       }
       $customGroups[$id]['extends_display'] = $customGroupExtends[$customGroups[$id]['extends']];
-      $customGroups[$id]['extends_entity_column_value'] = $customGroups[$id]['extends_entity_column_value'] ?? NULL;
+      $customGroups[$id]['extends_entity_column_value'] ??= NULL;
     }
 
     // FIXME: This hardcoded array is mostly redundant with CRM_Core_BAO_CustomGroup::getSubTypes
index cde33a8855d4c99f0206bea3562fd9fdc7ab6228..6406e058edc23a2bc46a752d41f7325e91e97483 100644 (file)
@@ -1651,7 +1651,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         $mainContactValue = $mainTree[$gid]['fields'][$fid]['customValue'] ?? NULL;
         $otherContactValue = $otherTree[$gid]['fields'][$fid]['customValue'] ?? NULL;
         if (in_array($fid, $compareFields['custom'])) {
-          $rows["custom_group_$gid"]['title'] = $rows["custom_group_$gid"]['title'] ?? $group['title'];
+          $rows["custom_group_$gid"]['title'] ??= $group['title'];
 
           if ($mainContactValue) {
             foreach ($mainContactValue as $valueId => $values) {
index 6f843c7742c038c72165f31709557e479975eaae..cb23cbd9975715a3510aca8421e58a4ad4922dc7 100644 (file)
@@ -102,7 +102,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event implements \Civi\Core\Hook
         // unless we are explicitly trying to create a new template
         // we want to set the `is_template` flag on the clone to false
         // so that the copy is a new event rather than a new template
-        $params['is_template'] = $params['is_template'] ?? 0;
+        $params['is_template'] ??= 0;
 
         //fix for api from template creation bug
         civicrm_api4('ActionSchedule', 'update', [
@@ -2043,7 +2043,7 @@ WHERE  ce.loc_block_id = $locBlockId";
    * @throws \CRM_Core_Exception
    */
   public static function checkPermission(int $eventId, $permissionType = CRM_Core_Permission::VIEW, $userId = NULL) {
-    $userId = $userId ?? CRM_Core_Session::getLoggedInContactID();
+    $userId ??= CRM_Core_Session::getLoggedInContactID();
     switch ($permissionType) {
       case CRM_Core_Permission::EDIT:
         // We also set the cached "view" permission to TRUE if "edit" is TRUE
index 82a28c5e66f2cd1fd1d190678edb83584666f5c6..c4149c3d48145e0f8d6540db1b117712c63348a5 100644 (file)
@@ -91,9 +91,9 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
     $this->assign('description', $defaults['description'] ?? '');
 
     // Provide suggested text for event full and waitlist messages if they're empty
-    $defaults['event_full_text'] = $defaults['event_full_text'] ?? ts('This event is currently full.');
+    $defaults['event_full_text'] ??= ts('This event is currently full.');
 
-    $defaults['waitlist_text'] = $defaults['waitlist_text'] ?? ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
+    $defaults['waitlist_text'] ??= ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
     $defaults['template_id'] = $this->_templateId;
 
     return $defaults;
@@ -216,15 +216,15 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
     $params = array_merge($this->controller->exportValues($this->_name), $this->_submitValues);
 
     //format params
-    $params['start_date'] = $params['start_date'] ?? NULL;
-    $params['end_date'] = $params['end_date'] ?? NULL;
-    $params['has_waitlist'] = $params['has_waitlist'] ?? FALSE;
-    $params['is_map'] = $params['is_map'] ?? FALSE;
-    $params['is_active'] = $params['is_active'] ?? FALSE;
-    $params['is_public'] = $params['is_public'] ?? FALSE;
-    $params['is_share'] = $params['is_share'] ?? FALSE;
-    $params['is_show_calendar_links'] = $params['is_show_calendar_links'] ?? FALSE;
-    $params['default_role_id'] = $params['default_role_id'] ?? FALSE;
+    $params['start_date'] ??= NULL;
+    $params['end_date'] ??= NULL;
+    $params['has_waitlist'] ??= FALSE;
+    $params['is_map'] ??= FALSE;
+    $params['is_active'] ??= FALSE;
+    $params['is_public'] ??= FALSE;
+    $params['is_share'] ??= FALSE;
+    $params['is_show_calendar_links'] ??= FALSE;
+    $params['default_role_id'] ??= FALSE;
     $params['id'] = $this->_id;
     //merge params with defaults from templates
     if (!empty($params['template_id'])) {
index 901b1a8c9c2f57427959dcabdc0aa04f8ce79de7..68e7bc02e3efa19a2bc1c92e285107b297a64712 100644 (file)
@@ -551,8 +551,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
       $params['payment_processor'] = 'null';
     }
 
-    $params['is_pay_later'] = $params['is_pay_later'] ?? 0;
-    $params['is_billing_required'] = $params['is_billing_required'] ?? 0;
+    $params['is_pay_later'] ??= 0;
+    $params['is_billing_required'] ??= 0;
 
     if ($this->_id) {
 
index 7b51f7281d0ae9a72fd38159d44c41a2e4e01478..9ee3ec93eb0d3e110bda0844631fa70b7af59d15 100644 (file)
@@ -162,10 +162,10 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
     }
 
     // provide defaults for required fields if empty (and as a 'hint' for approval message field)
-    $defaults['registration_link_text'] = $defaults['registration_link_text'] ?? ts('Register Now');
-    $defaults['confirm_title'] = $defaults['confirm_title'] ?? ts('Confirm Your Registration Information');
-    $defaults['thankyou_title'] = $defaults['thankyou_title'] ?? ts('Thank You for Registering');
-    $defaults['approval_req_text'] = $defaults['approval_req_text'] ?? ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.');
+    $defaults['registration_link_text'] ??= ts('Register Now');
+    $defaults['confirm_title'] ??= ts('Confirm Your Registration Information');
+    $defaults['thankyou_title'] ??= ts('Thank You for Registering');
+    $defaults['approval_req_text'] ??= ts('Participation in this event requires approval. Submit your registration request here. Once approved, you will receive an email with a link to a web page where you can complete the registration process.');
 
     return $defaults;
   }
@@ -783,12 +783,12 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
     $params['id'] = $this->_id;
 
     // format params
-    $params['is_online_registration'] = $params['is_online_registration'] ?? FALSE;
+    $params['is_online_registration'] ??= FALSE;
     // CRM-11182
-    $params['is_confirm_enabled'] = $params['is_confirm_enabled'] ?? FALSE;
-    $params['is_multiple_registrations'] = $params['is_multiple_registrations'] ?? FALSE;
-    $params['allow_same_participant_emails'] = $params['allow_same_participant_emails'] ?? FALSE;
-    $params['requires_approval'] = $params['requires_approval'] ?? FALSE;
+    $params['is_confirm_enabled'] ??= FALSE;
+    $params['is_multiple_registrations'] ??= FALSE;
+    $params['allow_same_participant_emails'] ??= FALSE;
+    $params['requires_approval'] ??= FALSE;
 
     // reset is_email confirm if not online reg
     if (!$params['is_online_registration']) {
index 954950e97294e72d2a50f977c26441b15b27c3c8..027db709d32f4c1703f19b688f6752f8677a4b19 100644 (file)
@@ -495,7 +495,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
 
     $this->assign('is_email_confirm', $this->_values['event']['is_email_confirm'] ?? NULL);
     // assign pay later stuff
-    $params['is_pay_later'] = $params['is_pay_later'] ?? FALSE;
+    $params['is_pay_later'] ??= FALSE;
     $this->assign('is_pay_later', $params['is_pay_later']);
     $this->assign('pay_later_text', $params['is_pay_later'] ? $this->getPayLaterLabel() : FALSE);
     $this->assign('pay_later_receipt', $params['is_pay_later'] ? $this->_values['event']['pay_later_receipt'] : NULL);
index a3614cfba5216d44338b05a9050360caf47969e6..05bcf8ab90590e0a2d773273dab14f70f13910f2 100644 (file)
@@ -669,7 +669,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
           }
         }
       }
-      $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetID;
+      $form->_priceSet['id'] ??= $priceSetID;
       $form->assign('priceSet', $form->_priceSet);
     }
     else {
index 48ece1b8c3a10a16c26b33c851ce93c1c028d375..e7854c4d7648b62549a860e0781aec631248e841 100644 (file)
@@ -953,7 +953,7 @@ class CRM_Financial_BAO_Order {
       elseif ($taxRate) {
         $lineItem['tax_amount'] = ($taxRate / 100) * $lineItem['line_total'];
       }
-      $lineItem['membership_type_id'] = $lineItem['membership_type_id'] ?? NULL;
+      $lineItem['membership_type_id'] ??= NULL;
       if ($lineItem['membership_type_id']) {
         $lineItem['entity_table'] = 'civicrm_membership';
       }
@@ -1219,8 +1219,8 @@ class CRM_Financial_BAO_Order {
       }
     }
     $lineItem['unit_price'] = $lineItem['line_total'] ?? $option['amount'];
-    $lineItem['label'] = $lineItem['label'] ?? $option['label'];
-    $lineItem['field_title'] = $lineItem['field_title'] ?? $option['label'];
+    $lineItem['label'] ??= $option['label'];
+    $lineItem['field_title'] ??= $option['label'];
     $lineItem['financial_type_id'] = $lineItem['financial_type_id'] ?: ($this->getDefaultFinancialTypeID() ?? $option['financial_type_id']);
     return $lineItem;
   }
index 281e78183e536471fa0d96e6b3fa9d838f5afd19..d5ab9090ec07c5400f1d313d708385985a0d6110 100644 (file)
@@ -49,7 +49,7 @@ class CRM_Financial_BAO_Payment {
     $paymentTrxnParams = array_intersect_key($params, array_fill_keys($whiteList, 1));
     $paymentTrxnParams['is_payment'] = 1;
     // Really we should have a DB default.
-    $paymentTrxnParams['fee_amount'] = $paymentTrxnParams['fee_amount'] ?? 0;
+    $paymentTrxnParams['fee_amount'] ??= 0;
 
     if (isset($paymentTrxnParams['payment_processor_id']) && empty($paymentTrxnParams['payment_processor_id'])) {
       // Don't pass 0 - ie the Pay Later processor as it is  a pseudo-processor.
index 2ea06f7705c71438f29e116b92cd4da95566233b..c0c2b03a1d70b2ff48b5570fcba98bef3a02013c 100644 (file)
@@ -201,7 +201,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
         $params['id'] = $this->_id;
       }
       foreach (['is_active', 'is_deductible', 'is_tax', 'is_default'] as $field) {
-        $params[$field] = $params[$field] ?? FALSE;
+        $params[$field] ??= FALSE;
       }
       $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
       CRM_Core_Session::setStatus(ts('The Financial Account \'%1\' has been saved.', [1 => $financialAccount->name]), ts('Saved'), 'success');
index 0a953bf5ba6ecf2593fb42349a1b52deff7a4e7c..8bbe41dbdc185f10d9e33c6103a42dfe8bce30e7 100644 (file)
@@ -118,7 +118,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Core_Form {
         $params['id'] = $this->_id;
       }
       foreach (['is_active', 'is_reserved', 'is_deductible'] as $field) {
-        $params[$field] = $params[$field] ?? FALSE;
+        $params[$field] ??= FALSE;
       }
       $financialType = civicrm_api3('FinancialType', 'create', $params);
       if ($this->_action & CRM_Core_Action::UPDATE) {
index a850add6ead39ad10b2e3c4a46298202202c3b56..e9064efc05ead9018947a977a8d67cb2d72ceab9 100644 (file)
@@ -331,8 +331,8 @@ WHERE  title = %1
         $params['group_type'] = [];
       }
 
-      $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
-      $params['is_active'] = $params['is_active'] ?? FALSE;
+      $params['is_reserved'] ??= FALSE;
+      $params['is_active'] ??= FALSE;
       $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
         $this->_id,
         'Group'
index 7d327675e0a83ad6e5de1b0e84893400de8a09cd..5af9f8688e57d17a1f8a98f49280b1d57dc5c007 100644 (file)
@@ -848,7 +848,7 @@ abstract class CRM_Import_Parser implements UserJobInterface {
    */
   protected function checkContactDuplicate(&$formatValues) {
     //retrieve contact id using contact dedupe rule
-    $formatValues['contact_type'] = $formatValues['contact_type'] ?? $this->getContactType();
+    $formatValues['contact_type'] ??= $this->getContactType();
     $formatValues['version'] = 3;
     $params = $formatValues;
     static $cIndieFields = NULL;
index 52c6bb78204b145f6cab96510e67e74b41e45a53..466bcfb07a9f5e19af7f7283fc45bda92b5c571e 100644 (file)
@@ -1472,7 +1472,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $params = self::processWorkflowPermissions($params);
     }
     if (!$id) {
-      $params['domain_id'] = $params['domain_id'] ?? CRM_Core_Config::domainID();
+      $params['domain_id'] ??= CRM_Core_Config::domainID();
     }
     if (
       ((!$id && empty($params['replyto_email'])) || !isset($params['replyto_email'])) &&
index c14c361b1ceb9c380cad91a6a9fdef27dfbf3900..21d53376ecaf67dbdb25375ad430f54145e04a12 100644 (file)
@@ -450,8 +450,8 @@ class CRM_Mailing_BAO_Query {
    */
   public static function tableNames(&$tables) {
     if (isset($tables['civicrm_mailing_job'])) {
-      $tables['civicrm_mailing'] = $tables['civicrm_mailing'] ?? 1;
-      $tables['civicrm_mailing_recipients'] = $tables['civicrm_mailing_recipients'] ?? 1;
+      $tables['civicrm_mailing'] ??= 1;
+      $tables['civicrm_mailing_recipients'] ??= 1;
     }
   }
 
index 7d1ff70887e0c2fe05b6e080a4b949d31a8633e4..e22245436990994f651219a0ac6634a15c5b713a 100644 (file)
@@ -322,7 +322,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
 
     $transaction = new CRM_Core_Transaction();
 
-    $params['id'] = $params['id'] ?? $ids['membership'] ?? NULL;
+    $params['id'] ??= $ids['membership'] ?? NULL;
     $membership = self::add($params);
 
     if (is_a($membership, 'CRM_Core_Error')) {
index 3540790485e53644ae89eb0b56aa5cb468f5e998..82a1da40adb3aebd2b038e6bef4f90153e0b399f 100644 (file)
@@ -43,9 +43,9 @@ class CRM_PCP_BAO_PCP extends CRM_PCP_DAO_PCP implements \Civi\Core\HookInterfac
     if ($event->action === 'create') {
       // For some reason `status_id` is allowed to be empty
       // FIXME: Why?
-      $event->params['status_id'] = $event->params['status_id'] ?? 0;
+      $event->params['status_id'] ??= 0;
       // Supply default for `currency`
-      $event->params['currency'] = $event->params['currency'] ?? Civi::settings()->get('defaultCurrency');
+      $event->params['currency'] ??= Civi::settings()->get('defaultCurrency');
     }
   }
 
index 86bc12ba7944ace8c7f2dd276d1cb1ff65698f9a..299deffe4dc3033c32e31e6dcde4637a4f470c5e 100644 (file)
@@ -145,8 +145,8 @@ class CRM_PCP_Form_Contribute extends CRM_Contribute_Form_ContributionPage {
     $dao->find(TRUE);
     $params['id'] = $dao->id;
     $params['is_active'] = $params['pcp_active'] ?? FALSE;
-    $params['is_approval_needed'] = $params['is_approval_needed'] ?? FALSE;
-    $params['is_tellfriend_enabled'] = $params['is_tellfriend_enabled'] ?? FALSE;
+    $params['is_approval_needed'] ??= FALSE;
+    $params['is_tellfriend_enabled'] ??= FALSE;
 
     CRM_PCP_BAO_PCPBlock::writeRecord($params);
 
index b51425d8c580140fa71ea79b8d99e3c701ea0c1f..17f7b4fc8b42328f704e87d8dcae23e364204ca0 100644 (file)
@@ -185,8 +185,8 @@ class CRM_PCP_Form_Event extends CRM_Event_Form_ManageEvent {
     $dao->find(TRUE);
     $params['id'] = $dao->id;
     $params['is_active'] = $params['pcp_active'] ?? FALSE;
-    $params['is_approval_needed'] = $params['is_approval_needed'] ?? FALSE;
-    $params['is_tellfriend_enabled'] = $params['is_tellfriend_enabled'] ?? FALSE;
+    $params['is_approval_needed'] ??= FALSE;
+    $params['is_tellfriend_enabled'] ??= FALSE;
 
     CRM_PCP_BAO_PCPBlock::writeRecord($params);
 
index 22eec5611046f2813b7f2f3b92ee2205ce9c1807..c49d49873827767a393757b72b1f3d4098045e96 100644 (file)
@@ -836,7 +836,7 @@ WHERE  id = %1";
         }
       }
     }
-    $form->_priceSet['id'] = $form->_priceSet['id'] ?? $priceSetId;
+    $form->_priceSet['id'] ??= $priceSetId;
     $form->assign('priceSet', $form->_priceSet);
 
     if ($className == 'CRM_Contribute_Form_Contribution_Main') {
index 5496fdabd089e17281e8b2a09b38590a61dbcafb..844d49fa966539f8a1765cd619241290fcc2beb3 100644 (file)
@@ -666,12 +666,12 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
       $params['option_amount'][$key] = CRM_Utils_Rule::cleanMoney($amount);
     }
 
-    $params['is_display_amounts'] = $params['is_display_amounts'] ?? FALSE;
-    $params['is_required'] = $params['is_required'] ?? FALSE;
-    $params['is_active'] = $params['is_active'] ?? FALSE;
-    $params['financial_type_id'] = $params['financial_type_id'] ?? FALSE;
-    $params['visibility_id'] = $params['visibility_id'] ?? FALSE;
-    $params['count'] = $params['count'] ?? FALSE;
+    $params['is_display_amounts'] ??= FALSE;
+    $params['is_required'] ??= FALSE;
+    $params['is_active'] ??= FALSE;
+    $params['financial_type_id'] ??= FALSE;
+    $params['visibility_id'] ??= FALSE;
+    $params['count'] ??= FALSE;
 
     // need the FKEY - price set id
     $params['price_set_id'] = $this->_sid;
@@ -689,7 +689,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
     if (isset($params['option_name'])) {
       $params['option_value'] = $params['option_name'];
     }
-    $params['is_enter_qty'] = $params['is_enter_qty'] ?? FALSE;
+    $params['is_enter_qty'] ??= FALSE;
 
     if ($params['html_type'] === 'Text') {
       // if html type is Text, force is_enter_qty on
index 3aeecdc00f4c267937560c787b254c7b1ffb3f60..364dd3cff1450f68816c8deae04c95d3d4c14fb1 100644 (file)
@@ -328,9 +328,9 @@ class CRM_Price_Form_Option extends CRM_Core_Form {
         $params[$field] = CRM_Utils_Rule::cleanMoney(trim($params[$field]));
       }
       $params['price_field_id'] = $this->_fid;
-      $params['is_default'] = $params['is_default'] ?? FALSE;
-      $params['is_active'] = $params['is_active'] ?? FALSE;
-      $params['visibility_id'] = $params['visibility_id'] ?? FALSE;
+      $params['is_default'] ??= FALSE;
+      $params['is_active'] ??= FALSE;
+      $params['visibility_id'] ??= FALSE;
       $ids = [];
       if ($this->_oid) {
         $params['id'] = $this->_oid;
index c9e630058ac469cd0231282dcc8c5fb5ae875b72..83bf3f9a87df29a44f9da719519e9b16762340ea 100644 (file)
@@ -243,8 +243,8 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
     // get the submitted form values.
     $params = $this->controller->exportValues('Set');
     $nameLength = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'name');
-    $params['is_active'] = $params['is_active'] ?? FALSE;
-    $params['financial_type_id'] = $params['financial_type_id'] ?? FALSE;
+    $params['is_active'] ??= FALSE;
+    $params['financial_type_id'] ??= FALSE;
 
     $compIds = [];
     $extends = $params['extends'] ?? NULL;
index 19d399edb0846957c4dc5f4191573b6a46d509ac..777c02094f3e9d29f288253a2c00a3c366c24a1c 100644 (file)
@@ -163,8 +163,8 @@ class CRM_Price_Page_Option extends CRM_Core_Page {
         }
       }
       $customOption[$id]['order'] = $customOption[$id]['weight'];
-      $customOption[$id]['help_pre'] = $customOption[$id]['help_pre'] ?? NULL;
-      $customOption[$id]['help_post'] = $customOption[$id]['help_post'] ?? NULL;
+      $customOption[$id]['help_pre'] ??= NULL;
+      $customOption[$id]['help_post'] ??= NULL;
       $customOption[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action,
         [
           'oid' => $id,
index 5024788f40ccfd31e18ca163e826cd0ad2d1332a..d6283c283e3d258ace21da3fb19515eb325ab7fd 100644 (file)
@@ -47,10 +47,10 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance implem
     }
 
     if (!$instanceID || !isset($params['id'])) {
-      $params['is_reserved'] = $params['is_reserved'] ?? FALSE;
-      $params['domain_id'] = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID());
+      $params['is_reserved'] ??= FALSE;
+      $params['domain_id'] ??= CRM_Core_Config::domainID();
       // CRM-17256 set created_id on report creation.
-      $params['created_id'] = $params['created_id'] ?? CRM_Core_Session::getLoggedInContactID();
+      $params['created_id'] ??= CRM_Core_Session::getLoggedInContactID();
     }
 
     if ($instanceID) {
index 91622e7c26f307f0d968bd429c531ed8c46622da..6b05e1edfe1368361dda447781c273035555b9be 100644 (file)
@@ -1396,7 +1396,7 @@ class CRM_Report_Form extends CRM_Core_Form {
         if (empty($field['operatorType'])) {
           $field['operatorType'] = '';
         }
-        $field['no_display'] = $field['no_display'] ?? FALSE;
+        $field['no_display'] ??= FALSE;
         $filterGroups[$groupingKey]['tables'][$table][$fieldName] = $field;
         // Filters is deprecated in favour of filterGroups.
         $filters[$table][$fieldName] = $field;
@@ -3686,7 +3686,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
    * @return array
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     // lets do the pager if in html mode
     $this->_limit = NULL;
 
@@ -3737,7 +3737,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
    * @param int|null $rowCount
    */
   public function setPager($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     // CRM-14115, over-ride row count if rowCount is specified in URL
     if ($this->_dashBoardRowCount) {
       $rowCount = $this->_dashBoardRowCount;
index d61beb941feee6f0af61173e35cbc05a6a6619ea..32f1f5a78beef5d9dede8a0460f0bb2dba438d8f 100644 (file)
@@ -505,7 +505,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
    * @param int|null $rowCount
    */
   public function setPager($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     $this->_rowsFound = $this->totalRows;
     parent::setPager($rowCount);
   }
index e1348f6c31ec7447a2864c49f8dcc79a6efb6502..b24927dba36d6d966632b99de465974b3066c707 100644 (file)
@@ -797,7 +797,7 @@ HERESQL;
    * @param int|null $rowCount
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     parent::limit($rowCount);
   }
 
@@ -806,7 +806,7 @@ HERESQL;
    * @param int|null $rowCount
    */
   public function setPager($rowCount = NULL): void {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     parent::setPager($rowCount);
   }
 
index f76b8292e0c7cebf29d9d711b730c381581fdfa5..9a4f994b7f41ebe1c4770b36a4763e821794f0a5 100644 (file)
@@ -352,7 +352,7 @@ class CRM_Report_Form_Contribute_DeferredRevenue extends CRM_Report_Form {
    * @param int|null $rowCount
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     $this->_limit = NULL;
   }
 
index 658db8e0ffeb9cb4463173a2daaa4c325c46cba4..841e395a9ee82c4fdfaa548d4e956ce1668e0b6d 100644 (file)
@@ -494,7 +494,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
    * @return array
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     return parent::limit($rowCount);
   }
 
@@ -504,7 +504,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
    * @param int|null $rowCount
    */
   public function setPager($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     parent::setPager($rowCount);
   }
 
index 3ad31bee78fa75b4625c19f5e9a5eff43fbd6cc1..4a800ebe66e35708a2698533ace5f1e8c76a48a1 100644 (file)
@@ -346,7 +346,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
    * @param int $rowCount
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     // lets do the pager if in html mode
     $this->_limit = NULL;
 
index 1d559b0a66fc3b31727e711ef9f85f153232eec8..9c21fb9f31c1a5c8f0baaa8683c1a7cc0f0fb7c0 100644 (file)
@@ -225,7 +225,7 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
    * @inheritDoc
    */
   public function limit($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     parent::limit($rowCount);
 
     // Modify limit.
@@ -243,7 +243,7 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
    * @param int|null $rowCount
    */
   public function setPager($rowCount = NULL) {
-    $rowCount = $rowCount ?? $this->getRowCount();
+    $rowCount ??= $this->getRowCount();
     $params = [
       'total' => $this->_rowsFound,
       'rowCount' => $rowCount,
index fe77273cfcaec7065931086df4a87d880e13141c..af913155bbafee60402fcd9d4981fc6e4ab334b5 100644 (file)
@@ -246,7 +246,7 @@ class CRM_Report_Form_Instance {
 
     if ($instanceID) {
       // this is already retrieved via Form.php
-      $defaults['description'] = $defaults['description'] ?? NULL;
+      $defaults['description'] ??= NULL;
       if (!empty($defaults['header'])) {
         $defaults['report_header'] = $defaults['header'];
       }
index baa9b86791ecfa660fce8c36dcb4b9372048ef53..ed52c8450b84a43c0de1aca3b1d6d5af2b46cd4a 100644 (file)
@@ -157,8 +157,8 @@ class CRM_SMS_Form_Provider extends CRM_Core_Form {
     }
 
     $recData = $values = $this->controller->exportValues($this->_name);
-    $recData['is_active'] = $recData['is_active'] ?? 0;
-    $recData['is_default'] = $recData['is_default'] ?? 0;
+    $recData['is_active'] ??= 0;
+    $recData['is_default'] ??= 0;
 
     if ($this->_action && (CRM_Core_Action::UPDATE || CRM_Core_Action::ADD)) {
       if ($this->_id) {
index 04a6a0ae3a60c195abf04d94c92396faf97ab2e2..3c278e186471f05b0d9c75cfda50a3dc1672bf8c 100644 (file)
@@ -192,7 +192,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
       CRM_Core_BAO_UFField::retrieve($params, $defaults);
 
       // set it to null if so (avoids crappy E_NOTICE errors below
-      $defaults['location_type_id'] = $defaults['location_type_id'] ?? NULL;
+      $defaults['location_type_id'] ??= NULL;
 
       //CRM-20861 - Include custom fields defined for address to set its default location type to 0.
       $specialFields = array_merge(CRM_Core_BAO_UFGroup::getLocationFields(), $addressCustomFields);
index c15b8715196af5b8afc152ff0a21fccd5baf6b40..7a9e2aa791ebcac0638baa8b28ca9fdba710136d 100644 (file)
@@ -651,7 +651,7 @@ abstract class CRM_Utils_Hook {
   public static function selectWhereClause($entity, array &$clauses, int $userId = NULL, array $conditions = []): void {
     $entityName = is_object($entity) ? CRM_Core_DAO_AllCoreTables::getBriefName(get_class($entity)) : $entity;
     $null = NULL;
-    $userId = $userId ?? (int) CRM_Core_Session::getLoggedInContactID();
+    $userId ??= (int) CRM_Core_Session::getLoggedInContactID();
     self::singleton()->invoke(['entity', 'clauses', 'userId', 'conditions'],
       $entityName, $clauses, $userId, $conditions,
       $null, $null,
index dae51abf9e9802758c6e1105f17c45e975fe4221..212386cf34303f14468b49b980d4a293e5fc0b6d 100644 (file)
@@ -202,7 +202,7 @@ class CRM_Utils_Money {
    * @throws \Brick\Money\Exception\UnknownCurrencyException
    */
   protected static function formatLocaleNumeric(string $amount, $locale = NULL, $currency = NULL, $numberOfPlaces = 2): string {
-    $currency = $currency ?? CRM_Core_Config::singleton()->defaultCurrency;
+    $currency ??= CRM_Core_Config::singleton()->defaultCurrency;
     $currencyObject = self::getCurrencyObject($currency);
     $money = Money::of($amount, $currencyObject, new CustomContext($numberOfPlaces), RoundingMode::HALF_UP);
     $formatter = new \NumberFormatter($locale ?? CRM_Core_I18n::getLocale(), NumberFormatter::DECIMAL);
index 15e83b244f74f7d73e2a19d0f86138076c6136c5..29faa7c8f11b8ccf36a453e214db096a60dab510 100644 (file)
@@ -93,10 +93,10 @@ class CRM_Utils_Recent {
         return [];
       }
     }
-    $params['title'] = $params['title'] ?? self::getTitle($params['entity_type'], $params['entity_id']);
-    $params['view_url'] = $params['view_url'] ?? self::getUrl($params['entity_type'], $params['entity_id'], 'view');
-    $params['edit_url'] = $params['edit_url'] ?? self::getUrl($params['entity_type'], $params['entity_id'], 'update');
-    $params['delete_url'] = $params['delete_url'] ?? (empty($params['is_deleted']) ? self::getUrl($params['entity_type'], $params['entity_id'], 'delete') : NULL);
+    $params['title'] ??= self::getTitle($params['entity_type'], $params['entity_id']);
+    $params['view_url'] ??= self::getUrl($params['entity_type'], $params['entity_id'], 'view');
+    $params['edit_url'] ??= self::getUrl($params['entity_type'], $params['entity_id'], 'update');
+    $params['delete_url'] ??= (empty($params['is_deleted']) ? self::getUrl($params['entity_type'], $params['entity_id'], 'delete') : NULL);
     self::add($params['title'], $params['view_url'], $params['entity_id'], $params['entity_type'], $params['contact_id'] ?? NULL, NULL, $params);
     return $params;
   }
index 35643cb0f63844cdbb11ee53038a5ec05a5f87d4..00b8a4f67ccebbfeef7472a306b9bbe9825d7a53 100644 (file)
@@ -254,8 +254,8 @@ class CRM_Utils_System {
     $forceBackend = FALSE
   ) {
     // handle legacy null params
-    $path = $path ?? '';
-    $query = $query ?? '';
+    $path ??= '';
+    $query ??= '';
 
     $query = self::makeQueryString($query);
 
index 2e1f3ee7188b32bf3459639a227ab877f0e32e1e..2059f8a607320ff60ea8e4946f1a530af270bb4c 100644 (file)
@@ -80,12 +80,12 @@ class DebugSubscriber implements EventSubscriberInterface {
       && (empty($apiRequest['params']['check_permissions']) || \CRM_Core_Permission::check('view debug output'))
     ) {
       if (is_a($result, '\Civi\Api4\Generic\Result')) {
-        $result->debug = $result->debug ?? [];
+        $result->debug ??= [];
         $debug =& $result->debug;
       }
       // result would not be an array for api3 getvalue
       elseif (is_array($result)) {
-        $result['xdebug'] = $result['xdebug'] ?? [];
+        $result['xdebug'] ??= [];
         $debug =& $result['xdebug'];
       }
       else {
index 3f2642ed7f6a5c986b5c57e508b1153308ac4c02..c8b145a7fa0c80ac08fa7264d708e64f183057a2 100644 (file)
@@ -188,7 +188,7 @@ class AutocompleteAction extends AbstractAction {
       if (!$initialSearchById && !empty($this->display['settings']['columns'][0]['rewrite'])) {
         $searchFields = array_merge($searchFields, $this->getTokens($this->display['settings']['columns'][0]['rewrite']));
       }
-      $this->display['settings']['limit'] = $this->display['settings']['limit'] ?? \Civi::settings()->get('search_autocomplete_count');
+      $this->display['settings']['limit'] ??= \Civi::settings()->get('search_autocomplete_count');
       $this->display['settings']['pager'] = [];
       $return = 'scroll:' . $this->page;
       // SearchKit treats comma-separated fieldnames as OR clauses
index 7b606a85dac3677cf1ddf7b2a4efe11364b27a50..8decd444ceb87d05b5c7b2e3f303599984daae18 100644 (file)
@@ -136,7 +136,7 @@ class BasicGetFieldsAction extends BasicGetAction {
       ], $fieldDefaults);
       $field += $defaults + $fieldDefaults;
       if (array_key_exists('label', $fieldDefaults)) {
-        $field['label'] = $field['label'] ?? $field['title'] ?? $field['name'];
+        $field['label'] ??= $field['title'] ?? $field['name'];
       }
       if (isset($field['options']) && is_array($field['options']) && empty($field['suffixes']) && array_key_exists('suffixes', $field)) {
         $this->setFieldSuffixes($field);
index c66482debd312982fa196d1f495ef399c20fa651..71c585612cc712eb30bb4ac543b653b5d6ae32a2 100644 (file)
@@ -195,7 +195,7 @@ class MailingGetSpecProvider extends \Civi\Core\Service\AutoService implements G
 
     }
 
-    $count = $count ?? "$tableName.event_queue_id";
+    $count ??= "$tableName.event_queue_id";
     $query = "(
       SELECT      COUNT($count)
       FROM        $tableName
index 7a1e4493d973d37354e6dd29735d6fd9c6a4e095..f57ceccd78260d6855bb2c3379ebcdee6a8f892a 100644 (file)
@@ -239,7 +239,7 @@ class CoreUtil {
    * @throws \CRM_Core_Exception
    */
   public static function checkAccessRecord(AbstractAction $apiRequest, array $record, int $userID = NULL): ?bool {
-    $userID = $userID ?? \CRM_Core_Session::getLoggedInContactID() ?? 0;
+    $userID ??= \CRM_Core_Session::getLoggedInContactID() ?? 0;
     $idField = self::getIdFieldName($apiRequest->getEntityName());
 
     // Super-admins always have access to everything
index e25b78f5283645351e49309645085b8e13f24239..c867d0066dc9bb1889ca281fbd3f4ff8b1d9f4d4 100644 (file)
@@ -162,7 +162,7 @@ class PropertyBag implements \ArrayAccess {
   public function offsetExists ($offset): bool {
     $prop = $this->handleLegacyPropNames($offset, TRUE);
     // If there's no prop, assume it's a custom property.
-    $prop = $prop ?? $offset;
+    $prop ??= $offset;
     return array_key_exists($prop, $this->props['default']);
   }
 
index 14cf3e72aed5485dfda2975ff47a630992f89bda..a20faa3db2ee696ff4b1343ceaba8aa5277f63e6 100644 (file)
@@ -490,7 +490,7 @@ function civicrm_api3_contribution_completetransaction($params): array {
     throw new CRM_Core_Exception(ts('Contribution already completed'), 'contribution_completed');
   }
 
-  $params['trxn_id'] = $params['trxn_id'] ?? $contribution->trxn_id;
+  $params['trxn_id'] ??= $contribution->trxn_id;
 
   $passThroughParams = [
     'fee_amount',
index 46294f1067b4dae3431f0ea70b08b4a91a197c39..5264076c835d6136a3efbbc34dba81f6bb63fd40 100644 (file)
@@ -63,7 +63,7 @@ function civicrm_api3_generic_getfields($apiRequest, $unique = TRUE) {
   $subentity = $apiRequest['params']['contact_type'] ?? NULL;
   $action = $apiRequest['params']['action'] ?? NULL;
   $sequential = empty($apiRequest['params']['sequential']) ? 0 : 1;
-  $apiRequest['params']['options'] = $apiRequest['params']['options'] ?? [];
+  $apiRequest['params']['options'] ??= [];
   $optionsToResolve = (array) ($apiRequest['params']['options']['get_options'] ?? []);
 
   if (!$action || $action == 'getvalue' || $action == 'getcount') {
index 84cbb2237571337d4e87ea2ad4c7898df83b38d7..a4a738dea6522da9936245c581d77adf38ae027c 100644 (file)
@@ -54,7 +54,7 @@ function civicrm_api3_loc_block_create($params) {
         }
         // Bother calling the api.
         else {
-          $info['contact_id'] = $info['contact_id'] ?? 'null';
+          $info['contact_id'] ??= 'null';
           $result = civicrm_api3($item, 'create', $info);
           $entities[$key] = $result['values'][$result['id']];
           $params[$key . '_id'] = $result['id'];
index c26d6b02e56c1b53de5412bfdded8cda581403de..8bf209a62b28a720033c726d329b4ed84390d69f 100644 (file)
@@ -294,7 +294,7 @@ function civicrm_api3_mailing_submit($params) {
   if (isset($params['approval_date'])) {
     $updateParams['approval_date'] = $params['approval_date'];
     $updateParams['approver_id'] = CRM_Core_Session::getLoggedInContactID();
-    $updateParams['approval_status_id'] = $updateParams['approval_status_id'] ?? CRM_Core_OptionGroup::getDefaultValue('mail_approval_status');
+    $updateParams['approval_status_id'] ??= CRM_Core_OptionGroup::getDefaultValue('mail_approval_status');
   }
   if (isset($params['approval_note'])) {
     $updateParams['approval_note'] = $params['approval_note'];
index 5669b163e98facf8e2cc41ad0f4819f5e79436ec..fe0030eb4c004ac5aab9fc220da4223378cf396e 100644 (file)
@@ -131,7 +131,7 @@ function civicrm_api3_order_create(array $params): array {
         && (!CRM_Event_BAO_ParticipantStatusType::getIsValidStatusForClass($entityParams['participant_status_id'], 'Pending'))) {
         throw new CRM_Core_Exception('Creating a participant via the Order API with a non "pending" status is not supported');
       }
-      $entityParams['participant_status_id'] = $entityParams['participant_status_id'] ?? 'Pending from incomplete transaction';
+      $entityParams['participant_status_id'] ??= 'Pending from incomplete transaction';
       $entityParams['status_id'] = $entityParams['participant_status_id'];
       $entityParams['skipLineItem'] = TRUE;
       $entityResult = civicrm_api3('Participant', 'create', $entityParams);
index 202ca7fc41c8acbc228dee0ec3696f7ecb2eb18c..d35ee301d696b26cf6a476a6d075d60a2a1d2138 100644 (file)
@@ -606,7 +606,7 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour,
        */
     }
   }
-  $profileFields[$profileID] = $profileFields[$profileID] ?? [];
+  $profileFields[$profileID] ??= [];
   uasort($profileFields[$profileID], "_civicrm_api3_order_by_weight");
   return $profileFields[$profileID];
 }
index da392f4933eb575e884eca85fc3161873c12976f..78a4257903f7cc3c18bacc5c437bd8b1950309af 100644 (file)
@@ -425,7 +425,7 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction {
       if (!empty($entity['data'])) {
         // If no submitted values but data exists, fill the minimum number of records
         for ($index = 0; $index < $entity['min']; $index++) {
-          $entityValues[$entityName][$index] = $entityValues[$entityName][$index] ?? ['fields' => []];
+          $entityValues[$entityName][$index] ??= ['fields' => []];
         }
         // Predetermined values override submitted values
         foreach ($entityValues[$entityName] as $index => $vals) {
index 79d4cdc24c3c1e8c3a33e9af845a0785ecc91721..88bdbf69849861908d307c51f4e506b7a4ca86e9 100644 (file)
@@ -221,7 +221,7 @@ function afform_civicrm_pageRun(&$page) {
     // If Afform specifies a contact type, lookup the contact and compare
     if (!empty($afform['summary_contact_type'])) {
       // Contact.get only needs to happen once
-      $contact = $contact ?? civicrm_api4('Contact', 'get', [
+      $contact ??= civicrm_api4('Contact', 'get', [
         'select' => ['contact_type', 'contact_sub_type'],
         'where' => [['id', '=', $cid]],
       ])->first();
index f794a073ffe723a01eee63c5b2d681ce606f92e4..eb168b4662224fae834004de6651d20ba7b2ab5a 100644 (file)
@@ -88,7 +88,7 @@ abstract class FormTestCase extends \PHPUnit\Framework\TestCase implements \Civi
    * @return mixed
    */
   protected function prefill($params) {
-    $params['name'] = $params['name'] ?? $this->getFormName();
+    $params['name'] ??= $this->getFormName();
     return $this->callApi4AjaxSuccess('Afform', 'prefill', $params);
   }
 
@@ -100,7 +100,7 @@ abstract class FormTestCase extends \PHPUnit\Framework\TestCase implements \Civi
    * @return mixed
    */
   protected function prefillError($params) {
-    $params['name'] = $params['name'] ?? $this->getFormName();
+    $params['name'] ??= $this->getFormName();
     return $this->callApi4AjaxError('Afform', 'prefill', $params);
   }
 
@@ -112,7 +112,7 @@ abstract class FormTestCase extends \PHPUnit\Framework\TestCase implements \Civi
    * @return mixed
    */
   protected function submit($params) {
-    $params['name'] = $params['name'] ?? $this->getFormName();
+    $params['name'] ??= $this->getFormName();
     return $this->callApi4AjaxSuccess('Afform', 'submit', $params);
   }
 
@@ -124,7 +124,7 @@ abstract class FormTestCase extends \PHPUnit\Framework\TestCase implements \Civi
    * @return mixed
    */
   protected function submitError($params) {
-    $params['name'] = $params['name'] ?? $this->getFormName();
+    $params['name'] ??= $this->getFormName();
     return $this->callApi4AjaxError('Afform', 'submit', $params);
   }
 
index b30fbf2ab3812c5b45620be97271958f07362c8a..246d62bdff474876c67476fd6f13ae3b857a617b 100644 (file)
@@ -421,7 +421,7 @@ class AuthenticatorTarget {
    */
   public function setPrincipal($args) {
     if (!empty($args['user'])) {
-      $args['userId'] = $args['userId'] ?? \CRM_Core_Config::singleton()->userSystem->getUfId($args['user']);
+      $args['userId'] ??= \CRM_Core_Config::singleton()->userSystem->getUfId($args['user']);
       if ($args['userId']) {
         unset($args['user']);
       }
index be66cfe0c7bff4ed7f106a5a86d73303ed278c94..49571aa4d50bd078f16e28ccacd16058115e07e0 100644 (file)
@@ -41,7 +41,7 @@ class OAuthLeagueFacade {
       $clientDef['options'] ?? [],
       $localOptions
     );
-    $options['redirectUri'] = $options['redirectUri'] ?? \CRM_OAuth_BAO_OAuthClient::getRedirectUri();
+    $options['redirectUri'] ??= \CRM_OAuth_BAO_OAuthClient::getRedirectUri();
 
     return [$class, $options];
   }
index 45718390e974d09a673dd2614482123cf059353a..b7be14c4e326b457d319ab26833c7f33c26c8118 100644 (file)
@@ -28,7 +28,7 @@ class OAuthTokenFacade {
    * @see \League\OAuth2\Client\Provider\AbstractProvider::getAccessToken()
    */
   public function init($options): array {
-    $options['storage'] = $options['storage'] ?? 'OAuthSysToken';
+    $options['storage'] ??= 'OAuthSysToken';
     if (!preg_match(self::STORAGE_TYPES, $options['storage'])) {
       throw new \CRM_Core_Exception("Invalid token storage ({$options['storage']})");
     }
index 75982ddf83fbceaade81e6e69f7fea73216f63d2..32d00aaead1a4f53d51511e7741b138ca0c44cb0 100644 (file)
@@ -118,7 +118,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction {
     }
 
     $this->_apiParams['checkPermissions'] = $this->savedSearch['api_params']['checkPermissions'] = empty($this->display['acl_bypass']);
-    $this->display['settings']['columns'] = $this->display['settings']['columns'] ?? [];
+    $this->display['settings']['columns'] ??= [];
 
     $this->processResult($result);
   }
@@ -388,7 +388,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction {
           $iconClass = \CRM_Utils_Array::first(array_filter((array) $data[$iconField]));
         }
       }
-      $iconClass = $iconClass ?? $icon['icon'];
+      $iconClass ??= $icon['icon'];
       if ($iconClass && !empty($icon['if'])) {
         $condition = $this->getRuleCondition($icon['if'], $isMulti);
         if (!is_null($condition[0]) && !(self::filterCompare($data, $condition, $isMulti ? $index : NULL))) {
index f9fca9b68b90a222cf4a1f427faff4673ef24fb0..014736dc6f56160044e47235c0dcd57dcc716845 100644 (file)
@@ -49,7 +49,7 @@ class Security {
     }
 
     // NULL means the current logged-in user
-    $userID = $userID ?? $this->getLoggedInUfID() ?? 0;
+    $userID ??= $this->getLoggedInUfID() ?? 0;
 
     if (!isset(\Civi::$statics[__METHOD__][$userID])) {
 
index 37da996ff4fb6e681e3195267e1cc2805551efbe..89927c608dab0e79507faadb911cc5586150738a 100644 (file)
@@ -8,22 +8,22 @@ class test_extension_manager_paymenttest extends CRM_Core_Payment {
   public static $counts = [];
 
   public function install() {
-    self::$counts['install'] = self::$counts['install'] ?? 0;
+    self::$counts['install'] ??= 0;
     self::$counts['install'] = 1 + (int) self::$counts['install'];
   }
 
   public function uninstall() {
-    self::$counts['uninstall'] = self::$counts['uninstall'] ?? 0;
+    self::$counts['uninstall'] ??= 0;
     self::$counts['uninstall'] = 1 + (int) self::$counts['uninstall'];
   }
 
   public function disable() {
-    self::$counts['disable'] = self::$counts['disable'] ?? 0;
+    self::$counts['disable'] ??= 0;
     self::$counts['disable'] = 1 + (int) self::$counts['disable'];
   }
 
   public function enable() {
-    self::$counts['enable'] = self::$counts['enable'] ?? 0;
+    self::$counts['enable'] ??= 0;
     self::$counts['enable'] = 1 + (int) self::$counts['enable'];
   }
 
index dad899768434aab958630e6b1bc8a3f1ec2e24a5..1a5da2509ca4969abe6c827c1caea7dbe0aebd72 100644 (file)
@@ -102,7 +102,7 @@ class CRM_Core_CopyTest extends CiviUnitTestCase {
 
     // init in case it's not defined
     foreach ($locParams as $field) {
-      $eventData[$field] = $eventData[$field] ?? '';
+      $eventData[$field] ??= '';
     }
 
     // differencing the data in original content for each locales
index 4ec755281541f6fe7b32e8402f1c4a26d1199c14..01de0c9affbd438727ba55072a295c3df39a9e3d 100644 (file)
@@ -163,7 +163,7 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase {
    */
   private function setupMembership($modifiedID = NULL): array {
     $contactID = $this->individualCreate();
-    $modifiedID = $modifiedID ?? $contactID;
+    $modifiedID ??= $contactID;
 
     $params = [
       'contact_id' => $contactID,
index 24be9cf28413a81c751a9de8a5c0c082752755cd..d2c11778002419dcfc4142ce1f2a16bb9df1e73b 100644 (file)
@@ -1197,7 +1197,7 @@ Attendees will need to install the [TeleFoo](http://telefoo.example.com) app.';
    * @return string
    */
   protected function renderText(array $rowContext, string $text, array $context = [], $isHtml = TRUE): string {
-    $context['schema'] = $context['schema'] ?? [];
+    $context['schema'] ??= [];
     foreach (array_keys($rowContext) as $key) {
       $context['schema'][] = $key;
     }
index 269ec23aedd00465dd87f997a15f5da0ec4bcc75..8994787a25649aa126e9a0fd3baf45c03d0b8473 100644 (file)
@@ -39,7 +39,7 @@ class AjaxTest extends Api4TestBase implements TransactionalInterface {
       'httpx' => $_SERVER['HTTP_X_REQUESTED_WITH'] ?? NULL,
     ];
     $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
-    $_SERVER['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'] ?? NULL;
+    $_SERVER['HTTP_REFERER'] ??= NULL;
     http_response_code(200);
   }
 
index d2ba33d869e7e37bf4013bf2868e2cb22860fcfd..11a8feeabf258ec675b14cc2f1fe1e004de50016 100644 (file)
@@ -75,7 +75,7 @@ class Mixlib {
 
     $phpCode = $this->getSourceCode($mixin);
     $mixinSpec = $this->parseString($phpCode);
-    $mixinSpec['mixinName'] = $mixinSpec['mixinName'] ?? preg_replace(';@.*$;', '', $mixin);
+    $mixinSpec['mixinName'] ??= preg_replace(';@.*$;', '', $mixin);
 
     $parts = explode('@', $mixin);
     $effectiveVersion = !empty($mixinSpec['mixinVersion']) ? $mixinSpec['mixinVersion'] : ($parts[1] ?? '');