From fcaf8cbaa706827fc575b561266ef74ae0a1191a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 26 Aug 2022 14:40:19 -0700 Subject: [PATCH] (NFC) CRM/ - Autoformat big clumps of `list()` statements Based on a quick grep, these files had a lot of `list()` statements, so I let PHPStorm clean them up. --- CRM/Activity/BAO/Query.php | 10 +++++----- CRM/Case/BAO/Case.php | 8 ++++---- CRM/Case/XMLProcessor/Process.php | 8 ++++---- CRM/Contribute/BAO/ContributionPage.php | 22 ++++++++-------------- CRM/Contribute/BAO/Query.php | 18 +++++++++--------- CRM/Dedupe/BAO/DedupeRuleGroup.php | 8 ++++---- CRM/Event/BAO/Event.php | 16 ++++++++-------- CRM/Event/BAO/Participant.php | 2 +- CRM/Event/BAO/Query.php | 8 ++++---- CRM/Event/Form/Participant.php | 12 +++++------- CRM/Export/BAO/Export.php | 8 ++++---- CRM/Mailing/BAO/Query.php | 8 ++++---- CRM/Member/BAO/Query.php | 4 ++-- CRM/Member/Form/Search.php | 10 +++++----- CRM/Utils/Mail/EmailProcessor.php | 14 +++++++------- CRM/Utils/System.php | 14 +++++++------- CRM/Utils/System/Joomla.php | 6 +++--- 17 files changed, 84 insertions(+), 92 deletions(-) diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index 329be2021a..95bea4d167 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -167,7 +167,7 @@ class CRM_Activity_BAO_Query { * @throws \CRM_Core_Exception */ public static function whereClauseSingle(&$values, &$query) { - list($name, $op, $value, $grouping) = $values; + [$name, $op, $value, $grouping] = $values; $fields = CRM_Activity_BAO_Activity::exportableFields(); $fieldSpec = $query->getFieldSpec($name); @@ -199,7 +199,7 @@ class CRM_Activity_BAO_Query { case 'activity_priority': $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("$name.label", $op, $value, 'String'); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [ 1 => $fields[$name]['title'], 2 => $op, @@ -332,7 +332,7 @@ class CRM_Activity_BAO_Query { case 'source_contact_id': $columnName = strstr($name, '_id') ? 'id' : 'sort_name'; $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("source_contact.{$columnName}", $op, $value, CRM_Utils_Type::typeToString($fields[$name]['type'])); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contact_DAO_Contact', $columnName, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contact_DAO_Contact', $columnName, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [ 1 => $fields[$name]['title'], 2 => $op, @@ -626,7 +626,7 @@ class CRM_Activity_BAO_Query { * @throws \CRM_Core_Exception */ public static function whereClauseSingleActivityText(&$values, &$query) { - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; $activityOptionValues = $query->getWhereValues('activity_option', $grouping); $activityOption = CRM_Utils_Array::value(2, $activityOptionValues, 6); @@ -642,7 +642,7 @@ class CRM_Activity_BAO_Query { } $query->_where[$grouping][] = "( " . implode(' OR ', $clauses) . " )"; - list($qillOp, $qillVal) = $query->buildQillForFieldValue(NULL, $name, $value, $op); + [$qillOp, $qillVal] = $query->buildQillForFieldValue(NULL, $name, $value, $op); $query->_qill[$grouping][] = ts("%1 %2 '%3'", [ 1 => $label, 2 => $qillOp, diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 21f0128f0f..c45b8dffd3 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1397,7 +1397,7 @@ HERESQL; $displayName = $info['display_name'] ?? NULL; - list($result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( + [$result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate( [ 'groupName' => 'msg_tpl_workflow_case', 'workflow' => 'case_activity', @@ -1597,7 +1597,7 @@ HERESQL; $groupInfo['title'] = $results['title']; $params = [['group', '=', $groupInfo['id'], 0, 0]]; $return = ['contact_id' => 1, 'sort_name' => 1, 'display_name' => 1, 'email' => 1, 'phone' => 1]; - list($globalContacts) = CRM_Contact_BAO_Query::apiQuery($params, $return, NULL, $sort, $offset, $rowCount, TRUE, $returnOnlyCount, FALSE); + [$globalContacts] = CRM_Contact_BAO_Query::apiQuery($params, $return, NULL, $sort, $offset, $rowCount, TRUE, $returnOnlyCount, FALSE); if ($returnOnlyCount) { return $globalContacts; @@ -3074,13 +3074,13 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')'; 'record_type_id' => 'Activity Source', 'return' => 'contact_id', ]); - list($name, $address) = CRM_Contact_BAO_Contact_Location::getEmailDetails($sourceContactId); + [$name, $address] = CRM_Contact_BAO_Contact_Location::getEmailDetails($sourceContactId); } // If 'From' email address not found for Source Activity Contact then // fetch the email from domain or logged in user. if (empty($address)) { - list($name, $address) = CRM_Core_BAO_Domain::getDefaultReceiptFrom(); + [$name, $address] = CRM_Core_BAO_Domain::getDefaultReceiptFrom(); } return "$name <$address>"; diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index ac0592cf03..21a83ab5e5 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -171,7 +171,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { $result = []; foreach ($caseRolesXML as $caseRoleXML) { foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) { - list($relationshipTypeID,) = $this->locateNameOrLabel($relationshipTypeXML); + [$relationshipTypeID] = $this->locateNameOrLabel($relationshipTypeXML); if ($relationshipTypeID === FALSE) { continue; } @@ -330,7 +330,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { if (!empty($caseTypeXML->CaseRoles) && $caseTypeXML->CaseRoles->RelationshipType) { foreach ($caseTypeXML->CaseRoles->RelationshipType as $relTypeXML) { - list(, $relationshipTypeMachineName) = $this->locateNameOrLabel($relTypeXML); + [, $relationshipTypeMachineName] = $this->locateNameOrLabel($relTypeXML); $result[] = $relationshipTypeMachineName; } } @@ -511,7 +511,7 @@ AND a.is_deleted = 0 if (!$activityDate) { $activityDate = $params['activity_date_time']; } - list($activity_date, $activity_time) = CRM_Utils_Date::setDateDefaults($activityDate); + [$activity_date, $activity_time] = CRM_Utils_Date::setDateDefaults($activityDate); $activityDateTime = CRM_Utils_Date::processDate($activity_date, $activity_time); //add reference offset to date. if ((int) $activityTypeXML->reference_offset) { @@ -621,7 +621,7 @@ AND a.is_deleted = 0 $targetContactId = is_array($activityParams['target_contact_id']) ? CRM_Utils_Array::first($activityParams['target_contact_id']) : $activityParams['target_contact_id']; - list($relTypeId, $a, $b) = explode('_', $activityTypeXML->default_assignee_relationship); + [$relTypeId, $a, $b] = explode('_', $activityTypeXML->default_assignee_relationship); $params = [ 'relationship_type_id' => $relTypeId, diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index f22fd39cc0..2303e6e946 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -259,13 +259,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } if ($isTest && !empty($params['custom_post_id'])) { - $params['custom_post_id'][] = [ - 'contribution_test', - '=', - 1, - 0, - 0, - ]; + $params['custom_post_id'][] = ['contribution_test', '=', 1, 0, 0]; } if (!$returnMessageText && !empty($gIds)) { @@ -323,7 +317,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $userID = $values['related_contact'] ?? NULL; } } - list($values['customPost_grouptitle'], $values['customPost']) = self::getProfileNameAndFields($postID, $userID, $params['custom_post_id']); + [$values['customPost_grouptitle'], $values['customPost']] = self::getProfileNameAndFields($postID, $userID, $params['custom_post_id']); } // Assign honoree values for the receipt. But first, stop any leaks from // previously assigned values. @@ -396,7 +390,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // signs up. Is used for cases like - on behalf of // contribution / signup ..etc if (array_key_exists('related_contact', $values)) { - list($ccDisplayName, $ccEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($values['related_contact']); + [$ccDisplayName, $ccEmail] = CRM_Contact_BAO_Contact_Location::getEmailDetails($values['related_contact']); $ccMailId = "{$ccDisplayName} <{$ccEmail}>"; //@todo - this is the only place in this function where $values is altered - but I can't find any evidence it is used @@ -424,7 +418,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ]; if ($returnMessageText) { - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); + [$sent, $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); return [ 'subject' => $subject, 'body' => $message, @@ -434,7 +428,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio } if (empty($values['receipt_from_name']) && empty($values['receipt_from_name'])) { - list($values['receipt_from_name'], $values['receipt_from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(); + [$values['receipt_from_name'], $values['receipt_from_email']] = CRM_Core_BAO_Domain::getNameAndEmail(); } if ($values['is_email_receipt']) { @@ -448,7 +442,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $sendTemplateParams['isEmailPdf'] = TRUE; $sendTemplateParams['contributionId'] = $values['contribution_id']; } - list($sent, $subject, $message) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); + [$sent, $subject, $message] = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } // send duplicate alert, if dupe match found during on-behalf-of processing. @@ -591,7 +585,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $template->assign('updateSubscriptionUrl', $url); } - list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($templatesParams); + [$sent] = CRM_Core_BAO_MessageTemplate::sendTemplate($templatesParams); if ($sent) { CRM_Core_Error::debug_log_message('Success: mail sent for recurring notification.'); @@ -622,7 +616,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio * @param array|null $fieldTypes */ public static function buildCustomDisplay($gid, $name, $cid, &$template, &$params, $fieldTypes = NULL) { - list($groupTitle, $values) = self::getProfileNameAndFields($gid, $cid, $params, $fieldTypes); + [$groupTitle, $values] = self::getProfileNameAndFields($gid, $cid, $params, $fieldTypes); if (!empty($values)) { $template->assign($name, $values); } diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 8f3ebd68e7..643d5dcb19 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -126,7 +126,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { * @throws \CRM_Core_Exception */ public static function whereClauseSingle(&$values, &$query) { - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; $quoteValue = NULL; $fields = self::getFields(); @@ -243,7 +243,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String'; $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.$name", $op, $value, $dataType); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op, $pseudoExtraParam); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op, $pseudoExtraParam); if (!($name == 'id' && $value == 0)) { $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]); } @@ -265,7 +265,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_soft.$name", $op, $value, CRM_Utils_Type::typeToString($fields[$qillName]['type']) ); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionSoft', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionSoft', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]); $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1; return; @@ -382,7 +382,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { case 'contribution_recur_contribution_status_id': $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.contribution_status_id", $op, $value, 'String'); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionRecur', 'contribution_status_id', $value, $op, $pseudoExtraParam); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionRecur', 'contribution_status_id', $value, $op, $pseudoExtraParam); $query->_qill[$grouping][] = ts("Recurring Contribution Status %1 '%2'", [1 => $op, 2 => $value]); $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1; return; @@ -421,7 +421,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { return; case 'contribution_batch_id': - list($qillOp, $qillValue) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Batch_BAO_EntityBatch', 'batch_id', $value, $op); + [$qillOp, $qillValue] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Batch_BAO_EntityBatch', 'batch_id', $value, $op); $query->_qill[$grouping][] = ts('Batch Name %1 %2', [1 => $qillOp, 2 => $qillValue]); $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_entity_batch.batch_id', $op, $value); $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1; @@ -432,7 +432,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { case 'contribution_product_id': // CRM-16713 - contribution search by premiums on 'Find Contribution' form. $qillName = $name; - list($operator, $productValue) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Product', $name, $value, $op); + [$operator, $productValue] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Product', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $operator, 3 => $productValue]); $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_product.id", $op, $value); $query->_tables['civicrm_product'] = $query->_whereTables['civicrm_product'] = 1; @@ -447,7 +447,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_financial_trxn.card_type_id', $op, $value); $query->_tables['civicrm_financial_trxn'] = $query->_whereTables['civicrm_financial_trxn'] = 1; $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1; - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'card_type_id', $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'card_type_id', $value, $op); $query->_qill[$grouping][] = ts('Card Type %1 %2', [1 => $op, 2 => $value]); return; @@ -455,7 +455,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_financial_trxn.pan_truncation', $op, $value); $query->_tables['civicrm_financial_trxn'] = $query->_whereTables['civicrm_financial_trxn'] = 1; $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1; - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'pan_truncation', $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'pan_truncation', $value, $op); $query->_qill[$grouping][] = ts('Card Number %1 %2', [1 => $op, 2 => $value]); return; @@ -477,7 +477,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($whereTable['where'], $op, $value, $dataType); $query->_qill[$grouping][] = "$whereTable[title] $op $quoteValue"; - list($tableName) = explode('.', $whereTable['where'], 2); + [$tableName] = explode('.', $whereTable['where'], 2); $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1; if ($tableName === 'civicrm_contribution_product') { $query->_tables['civicrm_product'] = $query->_whereTables['civicrm_product'] = 1; diff --git a/CRM/Dedupe/BAO/DedupeRuleGroup.php b/CRM/Dedupe/BAO/DedupeRuleGroup.php index 6faf28ce79..5e6f1d80b7 100644 --- a/CRM/Dedupe/BAO/DedupeRuleGroup.php +++ b/CRM/Dedupe/BAO/DedupeRuleGroup.php @@ -94,7 +94,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { if (isset($replacements[$where])) { $where = $replacements[$where]; } - list($table, $field) = explode('.', $where); + [$table, $field] = explode('.', $where); if (!in_array($table, $supportedTables)) { continue; } @@ -220,7 +220,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { CRM_Utils_Hook::dupeQuery($this, 'table', $tableQueries); while (!empty($tableQueries)) { - list($isInclusive, $isDie) = self::isQuerySetInclusive($tableQueries, $this->threshold, $exclWeightSum); + [$isInclusive, $isDie] = self::isQuerySetInclusive($tableQueries, $this->threshold, $exclWeightSum); if ($isInclusive) { // order queries by table count @@ -379,7 +379,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { if ($this->params && !$this->noRules) { if ($checkPermission) { - list($this->_aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause('civicrm_contact'); + [$this->_aclFrom, $aclWhere] = CRM_Contact_BAO_Contact_Permission::cacheClause('civicrm_contact'); $aclWhere = $aclWhere ? "AND {$aclWhere}" : ''; } $query = "SELECT {$this->temporaryTables['dedupe']}.id1 as id @@ -390,7 +390,7 @@ class CRM_Dedupe_BAO_DedupeRuleGroup extends CRM_Dedupe_DAO_DedupeRuleGroup { else { $aclWhere = ''; if ($checkPermission) { - list($this->_aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause(['c1', 'c2']); + [$this->_aclFrom, $aclWhere] = CRM_Contact_BAO_Contact_Permission::cacheClause(['c1', 'c2']); $aclWhere = $aclWhere ? "AND {$aclWhere}" : ''; } $query = "SELECT IF({$this->temporaryTables['dedupe']}.id1 < {$this->temporaryTables['dedupe']}.id2, {$this->temporaryTables['dedupe']}.id1, {$this->temporaryTables['dedupe']}.id2) as id1, diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 193081eb2e..9f12eeff0d 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1112,7 +1112,7 @@ WHERE civicrm_event.is_active = 1 } if ($values['event']['is_email_confirm'] || $returnMessageText) { - list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID); + [$displayName, $email] = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID); $notifyEmail = CRM_Utils_Array::valueByRegexKey('/^email-/', $participantParams) ?? $email; //send email only when email is present if (isset($notifyEmail) || $returnMessageText) { @@ -1230,7 +1230,7 @@ WHERE civicrm_event.is_active = 1 } if ($returnMessageText) { - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); + [$sent, $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); return [ 'subject' => $subject, 'body' => $message, @@ -1600,7 +1600,7 @@ WHERE civicrm_event.is_active = 1 $values[$index] = $campaigns[$params[$name]] ?? NULL; } elseif (strpos($name, '-') !== FALSE) { - list($fieldName, $id) = CRM_Utils_System::explode('-', $name, 2); + [$fieldName, $id] = CRM_Utils_System::explode('-', $name, 2); $detailName = str_replace(' ', '_', $name); if (in_array($fieldName, [ 'state_province', @@ -1813,7 +1813,7 @@ WHERE id = $cfID $participantParams = CRM_Utils_Array::value($pId, $values['params'], []); } - list($profilePre, $groupTitles) = self::buildCustomDisplay($preProfileID, + [$profilePre, $groupTitles] = self::buildCustomDisplay($preProfileID, 'additionalCustomPre', $cId, $template, @@ -1831,7 +1831,7 @@ WHERE id = $cfID } } - list($profilePost, $groupTitles) = self::buildCustomDisplay($postProfileID, + [$profilePost, $groupTitles] = self::buildCustomDisplay($postProfileID, 'additionalCustomPost', $cId, $template, @@ -2062,7 +2062,7 @@ WHERE ce.loc_block_id = $locBlockId"; } Civi::$statics[__CLASS__]['permission']['edit'][$eventId] = FALSE; - list($allEvents, $createdEvents) = self::checkPermissionGetInfo($eventId); + [$allEvents, $createdEvents] = self::checkPermissionGetInfo($eventId); // Note: for a multisite setup, a user with edit all events, can edit all events // including those from other sites if (($permissionType == CRM_Core_Permission::EDIT) && CRM_Core_Permission::check('edit all events')) { @@ -2081,7 +2081,7 @@ WHERE ce.loc_block_id = $locBlockId"; } Civi::$statics[__CLASS__]['permission']['view'][$eventId] = FALSE; - list($allEvents, $createdEvents) = self::checkPermissionGetInfo($eventId); + [$allEvents, $createdEvents] = self::checkPermissionGetInfo($eventId); if (CRM_Core_Permission::check('access CiviEvent')) { if (in_array($eventId, CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_event', $allEvents, array_keys($createdEvents)))) { // User created this event so has permission to view it @@ -2158,7 +2158,7 @@ WHERE ce.loc_block_id = $locBlockId"; */ public static function getAllPermissions() { if (!isset(Civi::$statics[__CLASS__]['permissions'])) { - list($allEvents, $createdEvents) = self::checkPermissionGetInfo(); + [$allEvents, $createdEvents] = self::checkPermissionGetInfo(); // Note: for a multisite setup, a user with edit all events, can edit all events // including those from other sites diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 9ab5ab46e4..dbf6edadda 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1422,7 +1422,7 @@ UPDATE civicrm_participant $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>'; } - list($mailSent, $subject) = CRM_Core_BAO_MessageTemplate::sendTemplate( + [$mailSent, $subject] = CRM_Core_BAO_MessageTemplate::sendTemplate( [ 'workflow' => 'participant_' . strtolower($mailType), 'contactId' => $contactId, diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 61500c645f..4e53555e3a 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -236,7 +236,7 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { */ public static function whereClauseSingle(&$values, &$query) { $checkPermission = empty($query->_skipPermission); - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; $fields = array_merge(CRM_Event_BAO_Event::fields(), CRM_Event_BAO_Participant::exportableFields()); $fieldSpec = $fields[$values[0]] ?? []; @@ -388,7 +388,7 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { } $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("$tableName.$name", $op, $value, $dataType); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]); $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; return; @@ -413,7 +413,7 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("$tableName.$name", $op, $value, $dataType); } - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]); $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; return; @@ -447,7 +447,7 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { if (!array_key_exists($qillName, $fields)) { break; } - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op, ['check_permission' => $checkPermission]); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op, ['check_permission' => $checkPermission]); $query->_qill[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]); return; diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 59ccd6772a..a81f025368 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -999,7 +999,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $params['total_amount'] = CRM_Utils_Rule::cleanMoney($params['total_amount']); } if ($this->_isPaidEvent) { - list($contributionParams, $lineItem, $additionalParticipantDetails, $params) = $this->preparePaidEventProcessing($params); + [$contributionParams, $lineItem, $additionalParticipantDetails, $params] = $this->preparePaidEventProcessing($params); } $this->_params = $params; @@ -1020,7 +1020,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $userName = CRM_Core_Session::singleton()->getLoggedInContactDisplayName(); if ($this->_contactId) { - list($this->_contributorDisplayName, $this->_contributorEmail, $this->_toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_contactId); + [$this->_contributorDisplayName, $this->_contributorEmail, $this->_toDoNotEmail] = CRM_Contact_BAO_Contact::getContactDetails($this->_contactId); } //modify params according to parameter used in create @@ -1459,7 +1459,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment foreach ($this->_contactIds as $num => $contactID) { // Retrieve the name and email of the contact - this will be the TO for receipt email - list($this->_contributorDisplayName, $this->_contributorEmail, $this->_toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($contactID); + [$this->_contributorDisplayName, $this->_contributorEmail, $this->_toDoNotEmail] = CRM_Contact_BAO_Contact::getContactDetails($contactID); $this->_contributorDisplayName = ($this->_contributorDisplayName == ' ') ? $this->_contributorEmail : $this->_contributorDisplayName; @@ -1550,7 +1550,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $sendTemplateParams['isEmailPdf'] = TRUE; $sendTemplateParams['contributionId'] = $contributionId; } - list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); + [$mailSent, $subject, $message, $html] = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); if ($mailSent) { $sent[] = $contactID; foreach ($participants as $ids => $values) { @@ -1761,9 +1761,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment // Retrieve the name and email of the contact - form will be the TO for receipt email ( only if context is not standalone) if ($form->_context != 'standalone') { if ($form->_contactId) { - list($form->_contributorDisplayName, - $form->_contributorEmail - ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($form->_contactId); + [$form->_contributorDisplayName, $form->_contributorEmail] = CRM_Contact_BAO_Contact_Location::getEmailDetails($form->_contactId); $form->assign('email', $form->_contributorEmail); } else { diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 6ff9506f45..16637e75d8 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -125,14 +125,14 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $processor->setComponentClause($componentClause); $processor->setIds($ids); - list($query, $queryString) = $processor->runQuery($params, $order); + [$query, $queryString] = $processor->runQuery($params, $order); // This perhaps only needs calling when $mergeSameHousehold == 1 self::buildRelatedContactArray($selectAll, $ids, $processor, $componentTable); $addPaymentHeader = FALSE; - list($outputColumns) = $processor->getExportStructureArrays(); + [$outputColumns] = $processor->getExportStructureArrays(); if ($processor->isMergeSameAddress()) { foreach (array_keys($processor->getAdditionalFieldsForSameAddressMerge()) as $field) { @@ -424,9 +424,9 @@ VALUES $sqlValueString $relationQuery = new CRM_Contact_BAO_Query(NULL, $relationReturnProperties, NULL, FALSE, FALSE, $queryMode ); - list($relationSelect, $relationFrom, $relationWhere, $relationHaving) = $relationQuery->query(); + [$relationSelect, $relationFrom, $relationWhere, $relationHaving] = $relationQuery->query(); - list($id, $direction) = explode('_', $relationshipKey, 2); + [$id, $direction] = explode('_', $relationshipKey, 2); // identify the relationship direction $contactA = 'contact_id_a'; $contactB = 'contact_id_b'; diff --git a/CRM/Mailing/BAO/Query.php b/CRM/Mailing/BAO/Query.php index b9d58a99fc..983c4654ed 100644 --- a/CRM/Mailing/BAO/Query.php +++ b/CRM/Mailing/BAO/Query.php @@ -236,7 +236,7 @@ class CRM_Mailing_BAO_Query { * @param $query */ public static function whereClauseSingle(&$values, &$query) { - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; switch ($name) { case 'mailing_id': @@ -281,7 +281,7 @@ class CRM_Mailing_BAO_Query { case 'mailing_delivery_status': $options = CRM_Mailing_PseudoConstant::yesNoOptions('delivered'); - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; if ($value == 'Y') { self::mailingEventQueryBuilder($query, $values, 'civicrm_mailing_event_delivered', @@ -378,7 +378,7 @@ class CRM_Mailing_BAO_Query { case 'mailing_campaign_id': $name = 'campaign_id'; $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_mailing.$name", $op, $value, 'Integer'); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Mailing_DAO_Mailing', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Mailing_DAO_Mailing', $name, $value, $op); $query->_qill[$grouping][] = ts('Campaign %1 %2', [1 => $op, 2 => $value]); $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1; $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1; @@ -467,7 +467,7 @@ class CRM_Mailing_BAO_Query { * @param $valueTitles */ public static function mailingEventQueryBuilder(&$query, &$values, $tableName, $fieldName, $fieldTitle, &$valueTitles) { - list($name, $op, $value, $grouping, $wildcard) = $values; + [$name, $op, $value, $grouping, $wildcard] = $values; if (empty($value) || $value == 'A') { // don't do any filtering diff --git a/CRM/Member/BAO/Query.php b/CRM/Member/BAO/Query.php index ed6702e916..7f91f01a40 100644 --- a/CRM/Member/BAO/Query.php +++ b/CRM/Member/BAO/Query.php @@ -150,7 +150,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { // $this->buildRelativeDateQuery($values); return; } - list($name, $op, $value, $grouping) = $values; + [$name, $op, $value, $grouping] = $values; $fields = self::getFields(); $quoteValue = NULL; @@ -273,7 +273,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { $value, "Integer" ); - list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Member_DAO_Membership', $name, $value, $op); + [$op, $value] = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Member_DAO_Membership', $name, $value, $op); $query->_qill[$grouping][] = $qillName . ' ' . $op . ' ' . $value; $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1; return; diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index dd937142ff..a0cc3e5ea0 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -300,7 +300,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $cid = CRM_Utils_Type::escape($cid, 'Integer'); if ($cid > 0) { $this->_formValues['contact_id'] = $cid; - list($display, $image) = CRM_Contact_BAO_Contact::getDisplayAndImage($cid); + [$display, $image] = CRM_Contact_BAO_Contact::getDisplayAndImage($cid); $this->_defaults['sort_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'sort_name' ); @@ -311,24 +311,24 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $fromDate = CRM_Utils_Request::retrieve('start', 'Date'); if ($fromDate) { - list($date) = CRM_Utils_Date::setDateDefaults($fromDate); + [$date] = CRM_Utils_Date::setDateDefaults($fromDate); $this->_formValues['member_start_date_low'] = $this->_defaults['member_start_date_low'] = $date; } $toDate = CRM_Utils_Request::retrieve('end', 'Date'); if ($toDate) { - list($date) = CRM_Utils_Date::setDateDefaults($toDate); + [$date] = CRM_Utils_Date::setDateDefaults($toDate); $this->_formValues['member_start_date_high'] = $this->_defaults['member_start_date_high'] = $date; } $joinDate = CRM_Utils_Request::retrieve('join', 'Date'); if ($joinDate) { - list($date) = CRM_Utils_Date::setDateDefaults($joinDate); + [$date] = CRM_Utils_Date::setDateDefaults($joinDate); $this->_formValues['member_join_date_low'] = $this->_defaults['member_join_date_low'] = $date; } $joinEndDate = CRM_Utils_Request::retrieve('joinEnd', 'Date'); if ($joinEndDate) { - list($date) = CRM_Utils_Date::setDateDefaults($joinEndDate); + [$date] = CRM_Utils_Date::setDateDefaults($joinEndDate); $this->_formValues['member_join_date_high'] = $this->_defaults['member_join_date_high'] = $date; } diff --git a/CRM/Utils/Mail/EmailProcessor.php b/CRM/Utils/Mail/EmailProcessor.php index cb72edc273..49e20acfb3 100644 --- a/CRM/Utils/Mail/EmailProcessor.php +++ b/CRM/Utils/Mail/EmailProcessor.php @@ -146,16 +146,16 @@ class CRM_Utils_Mail_EmailProcessor { if ($usedfor == 1) { foreach ($mail->to as $address) { if (preg_match($regex, ($address->email ?? ''), $matches)) { - list($match, $action, $job, $queue, $hash) = $matches; + [$match, $action, $job, $queue, $hash] = $matches; break; // FIXME: the below elseifs should be dropped when we drop legacy support } elseif (preg_match($commonRegex, ($address->email ?? ''), $matches)) { - list($match, $action, $_, $job, $queue, $hash) = $matches; + [$match, $action, $_, $job, $queue, $hash] = $matches; break; } elseif (preg_match($subscrRegex, ($address->email ?? ''), $matches)) { - list($match, $action, $_, $job) = $matches; + [$match, $action, $_, $job] = $matches; break; } } @@ -163,13 +163,13 @@ class CRM_Utils_Mail_EmailProcessor { // CRM-5471: if $matches is empty, it still might be a soft bounce sent // to another address, so scan the body for ‘Return-Path: …bounce-pattern…’ if (!$matches and preg_match($rpRegex, ($mail->generateBody() ?? ''), $matches)) { - list($match, $action, $job, $queue, $hash) = $matches; + [$match, $action, $job, $queue, $hash] = $matches; } // if $matches is still empty, look for the X-CiviMail-Bounce header // CRM-9855 if (!$matches and preg_match($rpXheaderRegex, ($mail->generateBody() ?? ''), $matches)) { - list($match, $action, $job, $queue, $hash) = $matches; + [$match, $action, $job, $queue, $hash] = $matches; } // With Mandrilla, the X-CiviMail-Bounce header is produced by generateBody // is base64 encoded @@ -181,7 +181,7 @@ class CRM_Utils_Mail_EmailProcessor { $p_file = $v_part->__get('fileName'); $c_file = file_get_contents($p_file); if (preg_match($rpXheaderRegex, ($c_file ?? ''), $matches)) { - list($match, $action, $job, $queue, $hash) = $matches; + [$match, $action, $job, $queue, $hash] = $matches; } } } @@ -189,7 +189,7 @@ class CRM_Utils_Mail_EmailProcessor { // if all else fails, check Delivered-To for possible pattern if (!$matches and preg_match($regex, ($mail->getHeader('Delivered-To') ?? ''), $matches)) { - list($match, $action, $job, $queue, $hash) = $matches; + [$match, $action, $job, $queue, $hash] = $matches; } } diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index b980182b80..345db10a47 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -126,7 +126,7 @@ class CRM_Utils_System { for ($i = 0, $cnt = count($qs); $i < $cnt; $i++) { // check first if exist a pair if (strstr($qs[$i], '=') !== FALSE) { - list($name, $value) = explode('=', $qs[$i]); + [$name, $value] = explode('=', $qs[$i]); if ($name != $urlVar) { $name = rawurldecode($name); // check for arrays in parameters: site.php?foo[]=1&foo[]=2&foo[]=3 @@ -265,15 +265,15 @@ class CRM_Utils_System { // Extract fragment from path or query if munged together if ($query && strstr($query, '#')) { - list($path, $fragment) = explode('#', $query); + [$path, $fragment] = explode('#', $query); } if ($path && strstr($path, '#')) { - list($path, $fragment) = explode('#', $path); + [$path, $fragment] = explode('#', $path); } // Extract query from path if munged together if ($path && strstr($path, '?')) { - list($path, $extraQuery) = explode('?', $path); + [$path, $extraQuery] = explode('?', $path); $query = $extraQuery . ($query ? "&$query" : ''); } @@ -723,7 +723,7 @@ class CRM_Utils_System { } elseif ($storeInSession) { // lets store contact id and user id in session - list($userID, $ufID, $randomNumber) = $result; + [$userID, $ufID, $randomNumber] = $result; if ($userID && $ufID) { $config = CRM_Core_Config::singleton(); $config->userSystem->setUserSession([$userID, $ufID]); @@ -995,7 +995,7 @@ class CRM_Utils_System { if (!array_key_exists($callback, self::$_callbacks)) { if (strpos($callback, '::') !== FALSE) { - list($className, $methodName) = explode('::', $callback); + [$className, $methodName] = explode('::', $callback); $fileName = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; // ignore errors if any @include_once $fileName; @@ -1171,7 +1171,7 @@ class CRM_Utils_System { * @return string */ public static function majorVersion() { - list($a, $b) = explode('.', self::version()); + [$a, $b] = explode('.', self::version()); return "$a.$b"; } diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index 91dd8b6e23..9bedbdeff2 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -378,7 +378,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { (version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt')) ) { // now check password - list($hash, $salt) = explode(':', $dbPassword); + [$hash, $salt] = explode(':', $dbPassword); $cryptpass = md5($password . $salt); if ($hash != $cryptpass) { return FALSE; @@ -420,7 +420,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * Array with user specific data. */ public function setUserSession($data) { - list($userID, $ufID) = $data; + [$userID, $ufID] = $data; $user = new JUser($ufID); $session = JFactory::getSession(); $session->set('user', $user); @@ -783,7 +783,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { return $civicrm_paths['cms.root']['path']; } - list($url, $siteName, $siteRoot) = $this->getDefaultSiteSettings(); + [$url, $siteName, $siteRoot] = $this->getDefaultSiteSettings(); if (file_exists("$siteRoot/administrator/index.php")) { return $siteRoot; } -- 2.25.1