From 40ade34b803313bd7c2a6d7883cda7c01596367e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 10 Apr 2023 16:49:28 +1200 Subject: [PATCH] Minor fixes around linting --- CRM/Contact/BAO/ContactType.php | 13 ++++++++----- CRM/Contact/Form/CustomData.php | 2 +- CRM/Contact/Form/DedupeRules.php | 4 ++-- CRM/Contact/Form/Search/Builder.php | 4 +--- CRM/Contact/Form/Task/AddToParentClass.php | 2 +- CRM/Contact/Import/MetadataTrait.php | 2 +- CRM/Contact/Import/Parser/Contact.php | 2 +- CRM/Contact/Page/View/Log.php | 2 +- CRM/Contact/Page/View/UserDashBoard.php | 7 +++++-- CRM/Core/Payment.php | 2 +- 10 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CRM/Contact/BAO/ContactType.php b/CRM/Contact/BAO/ContactType.php index c02fcf63fe..ecd502dfae 100644 --- a/CRM/Contact/BAO/ContactType.php +++ b/CRM/Contact/BAO/ContactType.php @@ -240,17 +240,20 @@ class CRM_Contact_BAO_ContactType extends CRM_Contact_DAO_ContactType implements /** * Get a list of elements for select box. - * Note that this used to default to using the hex(01) character - which results in an invalid character being used in form fields - * which was not handled well be anything that loaded & resaved the html (outside core) - * The use of this separator is now explicit in the calling functions as a step towards it's removal + * Note that this used to default to using the hex(01) character - which + * results in an invalid character being used in form fields which was not + * handled well be anything that loaded & resaved the html (outside core) The + * use of this separator is now explicit in the calling functions as a step + * towards it's removal * * @param bool $all * @param bool $isSeparator * @param string $separator * * @return mixed + * @throws \Civi\Core\Exception\DBQueryException */ - public static function getSelectElements( + public static function getSelectElements( $all = FALSE, $isSeparator = TRUE, $separator = '__' @@ -743,7 +746,7 @@ WHERE extends = %1 AND ' . implode(" OR ", $subTypeClause); * * @todo what does this function do? */ - public static function deleteCustomSetForSubtypeMigration( + public static function deleteCustomSetForSubtypeMigration( $contactID, $contactType, $oldSubtypeSet = [], diff --git a/CRM/Contact/Form/CustomData.php b/CRM/Contact/Form/CustomData.php index a54431bea5..da7ab34fd8 100644 --- a/CRM/Contact/Form/CustomData.php +++ b/CRM/Contact/Form/CustomData.php @@ -137,7 +137,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form { $this->_contactSubType = CRM_Contact_BAO_Contact::getContactSubType($this->_tableID, ','); $this->assign('contact_type', $this->_contactType); $this->assign('contact_subtype', $this->_contactSubType); - list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID); + [$displayName, $contactImage] = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID); $this->setTitle($displayName, $contactImage . ' ' . $displayName); // when custom data is included in this page diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index 1ac21b3510..9b85814dc2 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -241,10 +241,10 @@ UPDATE civicrm_dedupe_rule_group if (empty($values["where_$count"])) { continue; } - list($table, $field) = explode('.', CRM_Utils_Array::value("where_$count", $values)); + [$table, $field] = explode('.', CRM_Utils_Array::value("where_$count", $values)); $length = !empty($values["length_$count"]) ? CRM_Utils_Array::value("length_$count", $values) : NULL; $weight = $values["weight_$count"]; - if ($table and $field) { + if ($table && $field) { $ruleDao = new CRM_Dedupe_DAO_DedupeRule(); $ruleDao->dedupe_rule_group_id = $rgDao->id; $ruleDao->rule_table = $table; diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index 4441dd702c..f3c252c20b 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -685,9 +685,7 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { ]; if (isset($mappingId)) { - list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, - $mappingRelation, $mappingOperator, $mappingValue - ) = $this->getMappingFields($mappingId); + [$mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue] = $this->getMappingFields($mappingId); $blkCnt = count($mappingName); if ($blkCnt >= $blockCount) { diff --git a/CRM/Contact/Form/Task/AddToParentClass.php b/CRM/Contact/Form/Task/AddToParentClass.php index 55f228e2ed..cd810c0555 100644 --- a/CRM/Contact/Form/Task/AddToParentClass.php +++ b/CRM/Contact/Form/Task/AddToParentClass.php @@ -179,7 +179,7 @@ class CRM_Contact_Form_Task_AddToParentClass extends CRM_Contact_Form_Task { if (!empty($params['relationship_type_id'])) { $relationshipType = new CRM_Contact_DAO_RelationshipType(); - list($rid, $direction) = explode('_', $params['relationship_type_id'], 2); + [$rid, $direction] = explode('_', $params['relationship_type_id'], 2); $relationshipType->id = $rid; if ($relationshipType->find(TRUE)) { diff --git a/CRM/Contact/Import/MetadataTrait.php b/CRM/Contact/Import/MetadataTrait.php index 132782496b..62c8f7277a 100644 --- a/CRM/Contact/Import/MetadataTrait.php +++ b/CRM/Contact/Import/MetadataTrait.php @@ -37,7 +37,7 @@ trait CRM_Contact_Import_MetadataTrait { } foreach ($this->getRelationships() as $key => $var) { - list($type) = explode('_', $key); + [$type] = explode('_', $key); $relationshipType[$key]['title'] = $var; $relationshipType[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/'; $relationshipType[$key]['import'] = TRUE; diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index b9c3f95bdd..c5d1e2cd62 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1558,7 +1558,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { throw new CRM_Core_Exception('Mismatched contact SubTypes :', CRM_Import_Parser::NO_MATCH); } } - return array($formatted, $params); + return [$formatted, $params]; } /** diff --git a/CRM/Contact/Page/View/Log.php b/CRM/Contact/Page/View/Log.php index 1e869a50c3..8133f9eddc 100644 --- a/CRM/Contact/Page/View/Log.php +++ b/CRM/Contact/Page/View/Log.php @@ -41,7 +41,7 @@ class CRM_Contact_Page_View_Log extends CRM_Core_Page { $logEntries = []; while ($log->fetch()) { - list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id); + [$displayName, $contactImage] = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id); $logEntries[] = [ 'id' => $log->modified_id, 'name' => $displayName, diff --git a/CRM/Contact/Page/View/UserDashBoard.php b/CRM/Contact/Page/View/UserDashBoard.php index 9cb559bf47..83d501720f 100644 --- a/CRM/Contact/Page/View/UserDashBoard.php +++ b/CRM/Contact/Page/View/UserDashBoard.php @@ -73,14 +73,17 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page { /** * Heart of the viewing process. * - * The runner gets all the meta data for the contact and calls the appropriate type of page to view. + * The runner gets all the meta data for the contact and calls the + * appropriate type of page to view. + * + * @throws \CRM_Core_Exception */ public function preProcess() { if (!$this->_contactId) { throw new CRM_Core_Exception(ts('You must be logged in to view this page.')); } - list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId); + [$displayName, $contactImage] = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId); $this->set('displayName', $displayName); $this->set('contactImage', $contactImage); diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index b8f80dd8a9..2eeed7b063 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -150,7 +150,7 @@ abstract class CRM_Core_Payment { * Note: * We normally SHOULD be returning the payment instrument of the payment processor. * However there is an outstanding case where this needs overriding, which is - * when using CRM_Core_Payment_Manual which uses the pseudoprocessor (id = 0). + * when using CRM_Core_Payment_Manual which uses the pseudo-processor (id = 0). * * i.e. If you're writing a Payment Processor you should NOT be using * setPaymentInstrumentID() at all. -- 2.25.1