From affcc9d2e0105f7b23fe3abd9741f8dc146428e3 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 2 Jun 2020 10:42:55 -0400 Subject: [PATCH] NFC - Change array() to short syntax [] --- CRM/Admin/Page/ConfigTaskList.php | 2 +- CRM/Admin/Page/Job.php | 2 +- CRM/Admin/Page/JobLog.php | 2 +- CRM/Admin/Page/PaymentProcessor.php | 4 +- CRM/Campaign/Form/Search.php | 2 +- CRM/Case/XMLProcessor/Report.php | 42 +++++++++---------- CRM/Contact/Form/Task/SaveSearch/Update.php | 2 +- CRM/Contact/Import/Form/Preview.php | 28 ++++++------- CRM/Contact/Import/ImportJob.php | 10 ++--- CRM/Contact/Page/View/Relationship.php | 2 +- CRM/Contact/Page/View/Summary.php | 8 ++-- CRM/Contact/Task.php | 4 +- CRM/Contribute/Form/UpdateBilling.php | 8 ++-- CRM/Contribute/Page/ContributionPage.php | 18 ++++---- CRM/Core/Action.php | 2 +- CRM/Core/BAO/CustomField.php | 2 +- CRM/Core/BAO/Note.php | 8 ++-- CRM/Core/Block.php | 24 +++++------ CRM/Core/Menu.php | 34 +++++++-------- CRM/Event/Form/Registration.php | 36 ++++++++-------- CRM/Event/Import/Form/MapField.php | 20 ++++----- CRM/Extension/Browser.php | 12 +++--- CRM/Extension/Container/Default.php | 2 +- CRM/Extension/Downloader.php | 2 +- CRM/Group/Form/Edit.php | 14 +++---- CRM/Mailing/Event/BAO/Bounce.php | 2 +- CRM/Member/Import/Form/MapField.php | 24 +++++------ CRM/Member/Page/DashBoard.php | 2 +- CRM/Pledge/BAO/Pledge.php | 40 +++++++++--------- CRM/Pledge/BAO/PledgeBlock.php | 14 +++---- CRM/Report/Form/Campaign/SurveyDetails.php | 40 +++++++++--------- CRM/Report/Form/Contact/Summary.php | 4 +- CRM/Report/Form/Contribute/Repeat.php | 14 +++---- CRM/Report/Form/Event/ParticipantListing.php | 12 +++--- CRM/SMS/Page/Provider.php | 2 +- CRM/SMS/Provider.php | 6 +-- Civi.php | 4 +- Civi/Core/Themes.php | 6 +-- Civi/Test/DbTestTrait.php | 2 +- Civi/Test/GenericAssertionsTrait.php | 4 +- Civi/Test/MailingTestTrait.php | 2 +- install/civicrm.php | 2 +- .../main.php | 2 +- .../main.php | 4 +- tests/phpunit/CiviTest/CiviDBAssert.php | 2 +- tests/phpunit/CiviTest/CiviMailUtils.php | 8 ++-- tests/phpunit/CiviTest/CiviReportTestCase.php | 4 +- .../phpunit/CiviTest/CiviTestSMSProvider.php | 8 ++-- tests/phpunit/CiviTest/CiviTestSuite.php | 6 +-- tests/phpunit/E2E/Core/AssetBuilderTest.php | 2 +- tests/phpunit/E2E/Extern/RestTest.php | 4 +- tests/phpunit/E2E/Extern/SoapTest.php | 2 +- 52 files changed, 256 insertions(+), 256 deletions(-) diff --git a/CRM/Admin/Page/ConfigTaskList.php b/CRM/Admin/Page/ConfigTaskList.php index f4a6556603..ab7e91de61 100644 --- a/CRM/Admin/Page/ConfigTaskList.php +++ b/CRM/Admin/Page/ConfigTaskList.php @@ -46,7 +46,7 @@ class CRM_Admin_Page_ConfigTaskList extends CRM_Core_Page { 'sequential' => 1, 'return' => ["enable_components"], ]); - $enabled = array(); + $enabled = []; foreach ($result['values'][0]['enable_components'] as $component) { $enabled[$component] = 1; } diff --git a/CRM/Admin/Page/Job.php b/CRM/Admin/Page/Job.php index f2eed5d69c..e8ba06d9d5 100644 --- a/CRM/Admin/Page/Job.php +++ b/CRM/Admin/Page/Job.php @@ -144,7 +144,7 @@ class CRM_Admin_Page_Job extends CRM_Core_Page_Basic { } $sj = new CRM_Core_JobManager(); - $rows = $temp = array(); + $rows = $temp = []; foreach ($sj->jobs as $job) { $action = array_sum(array_keys($this->links())); diff --git a/CRM/Admin/Page/JobLog.php b/CRM/Admin/Page/JobLog.php index 6f23cf0857..c7b1226535 100644 --- a/CRM/Admin/Page/JobLog.php +++ b/CRM/Admin/Page/JobLog.php @@ -95,7 +95,7 @@ class CRM_Admin_Page_JobLog extends CRM_Core_Page_Basic { } $dao->find(); - $rows = array(); + $rows = []; while ($dao->fetch()) { unset($row); CRM_Core_DAO::storeValues($dao, $row); diff --git a/CRM/Admin/Page/PaymentProcessor.php b/CRM/Admin/Page/PaymentProcessor.php index 814b0064c7..1fb115f8e8 100644 --- a/CRM/Admin/Page/PaymentProcessor.php +++ b/CRM/Admin/Page/PaymentProcessor.php @@ -108,7 +108,7 @@ class CRM_Admin_Page_PaymentProcessor extends CRM_Core_Page_Basic { */ public function browse($action = NULL) { // get all custom groups sorted by weight - $paymentProcessor = array(); + $paymentProcessor = []; $dao = new CRM_Financial_DAO_PaymentProcessor(); $dao->is_test = 0; $dao->domain_id = CRM_Core_Config::domainID(); @@ -116,7 +116,7 @@ class CRM_Admin_Page_PaymentProcessor extends CRM_Core_Page_Basic { $dao->find(); while ($dao->fetch()) { - $paymentProcessor[$dao->id] = array(); + $paymentProcessor[$dao->id] = []; CRM_Core_DAO::storeValues($dao, $paymentProcessor[$dao->id]); $paymentProcessor[$dao->id]['payment_processor_type'] = CRM_Core_PseudoConstant::getLabel( 'CRM_Financial_DAO_PaymentProcessor', 'payment_processor_type_id', $dao->payment_processor_type_id diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index 66d744995c..e110db8d6e 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -55,7 +55,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { */ public function preProcess() { $this->_done = FALSE; - $this->_defaults = array(); + $this->_defaults = []; //set the button name. $this->_printButtonName = $this->getButtonName('next', 'print'); diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index c4fcba5670..1fdff00915 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -63,10 +63,10 @@ class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor { $clientID, $caseID ) { - $case = $this->_redactionRegexRules = array(); + $case = $this->_redactionRegexRules = []; if (empty($this->_redactionStringRules)) { - $this->_redactionStringRules = array(); + $this->_redactionStringRules = []; } if ($this->_isRedact == 1) { @@ -111,7 +111,7 @@ class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor { foreach ($xml->ActivitySets as $activitySetsXML) { foreach ($activitySetsXML->ActivitySet as $activitySetXML) { if ((string ) $activitySetXML->name == $activitySetName) { - $activityTypes = array(); + $activityTypes = []; $allActivityTypes = CRM_Case_PseudoConstant::caseActivityType(TRUE, TRUE); foreach ($activitySetXML->ActivityTypes as $activityTypesXML) { foreach ($activityTypesXML as $activityTypeXML) { @@ -192,7 +192,7 @@ AND ac.case_id = %1 * @return mixed */ public function &getActivityInfo($clientID, $activityID, $anyActivity = FALSE, $redact = 0) { - static $activityInfos = array(); + static $activityInfos = []; if ($redact) { $this->_isRedact = 1; $this->getRedactionRules(); @@ -205,7 +205,7 @@ AND ac.case_id = %1 } if (!array_key_exists($index, $activityInfos)) { - $activityInfos[$index] = array(); + $activityInfos[$index] = []; $selectCaseActivity = ""; $joinCaseActivity = ""; @@ -259,11 +259,11 @@ WHERE a.id = %1 */ public function &getActivity($clientID, $activityDAO, &$activityTypeInfo) { if (empty($this->_redactionStringRules)) { - $this->_redactionStringRules = array(); + $this->_redactionStringRules = []; } - $activity = array(); - $activity['fields'] = array(); + $activity = []; + $activity['fields'] = []; if ($clientID) { $clientID = CRM_Utils_Type::escape($clientID, 'Integer'); if (!in_array($activityTypeInfo['name'], array( @@ -326,7 +326,7 @@ WHERE a.id = %1 } if ($processTarget) { - $targetRedacted = array(); + $targetRedacted = []; foreach ($targetNames as $targetID => $target) { // add Recipient SortName as well as Display to the strings to be redacted across the case session // suffixed with a randomly generated 4-digit number @@ -513,11 +513,11 @@ WHERE a.id = %1 $params = array(1 => array($activityDAO->id, 'Integer')); - $customGroups = array(); + $customGroups = []; foreach ($sql as $tableName => $sqlClause) { $dao = CRM_Core_DAO::executeQuery($sqlClause, $params); if ($dao->fetch()) { - $customGroup = array(); + $customGroup = []; foreach ($typeValues[$tableName] as $columnName => $typeValue) { if (CRM_Utils_Array::value('type', $typeValue) == 'Date') { @@ -565,7 +565,7 @@ WHERE a.id = %1 * @return mixed */ public function getActivityTypeCustomSQL($activityTypeID, $dateFormat = NULL, $onlyActive = TRUE) { - static $cache = array(); + static $cache = []; if (is_null($activityTypeID)) { $activityTypeID = 0; @@ -606,11 +606,11 @@ AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, 'cg.') ); $dao = CRM_Core_DAO::executeQuery($query, $params); - $result = $options = $sql = $groupTitle = array(); + $result = $options = $sql = $groupTitle = []; while ($dao->fetch()) { if (!array_key_exists($dao->tableName, $result)) { - $result[$dao->tableName] = array(); - $sql[$dao->tableName] = array(); + $result[$dao->tableName] = []; + $sql[$dao->tableName] = []; } $result[$dao->tableName][$dao->columnName] = array( 'label' => $dao->label, @@ -618,7 +618,7 @@ AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, 'cg.') 'fieldID' => $dao->fieldID, ); - $options[$dao->fieldID] = array(); + $options[$dao->fieldID] = []; $options[$dao->fieldID]['attributes'] = array( 'label' => $dao->label, 'data_type' => $dao->dataType, @@ -695,7 +695,7 @@ LIMIT 1 * * @return mixed */ - private function redact($string, $printReport = FALSE, $replaceString = array()) { + private function redact($string, $printReport = FALSE, $replaceString = []) { if ($printReport) { return CRM_Utils_String::redaction($string, $replaceString); } @@ -787,7 +787,7 @@ LIMIT 1 $template->assign_by_ref('activitySet', $activitySet); //now collect all the information about activities - $activities = array(); + $activities = []; $form->getActivities($clientID, $caseID, $activityTypes, $activities); $template->assign_by_ref('activities', $activities); @@ -800,7 +800,7 @@ LIMIT 1 $activitySetName = CRM_Utils_Request::retrieve('asn', 'String'); $isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean'); $includeActivities = CRM_Utils_Request::retrieve('all', 'Positive'); - $params = $otherRelationships = $globalGroupInfo = array(); + $params = $otherRelationships = $globalGroupInfo = []; $report = new CRM_Case_XMLProcessor_Report($isRedact); if ($includeActivities) { $params['include_activities'] = 1; @@ -808,7 +808,7 @@ LIMIT 1 if ($isRedact) { $params['is_redact'] = 1; - $report->_redactionStringRules = array(); + $report->_redactionStringRules = []; } $template = CRM_Core_Smarty::singleton(); @@ -960,7 +960,7 @@ LIMIT 1 $customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($caseID, 'Case'); $extends = array('case'); $groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, NULL, $extends); - $caseCustomFields = array(); + $caseCustomFields = []; foreach ($groupTree as $gid => $group_values) { foreach ($group_values['fields'] as $id => $field_values) { if (array_key_exists($id, $customValues)) { diff --git a/CRM/Contact/Form/Task/SaveSearch/Update.php b/CRM/Contact/Form/Task/SaveSearch/Update.php index 72a4b81dcd..76505b00ab 100644 --- a/CRM/Contact/Form/Task/SaveSearch/Update.php +++ b/CRM/Contact/Form/Task/SaveSearch/Update.php @@ -51,7 +51,7 @@ class CRM_Contact_Form_Task_SaveSearch_Update extends CRM_Contact_Form_Task_Save $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1) ); - $defaults['group_type'] = array(); + $defaults['group_type'] = []; foreach ($types as $type) { $defaults['group_type'][$type] = 1; } diff --git a/CRM/Contact/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php index a8df3f6138..77ddd7afa2 100644 --- a/CRM/Contact/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -169,7 +169,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { * list of errors to be posted back to the form */ public static function formRule($fields, $files, $self) { - $errors = array(); + $errors = []; $invalidTagName = $invalidGroupName = FALSE; if (!empty($fields['newTagName'])) { @@ -263,7 +263,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { // check if there is any error occurred $errorStack = CRM_Core_Error::singleton(); $errors = $errorStack->getErrors(); - $errorMessage = array(); + $errorMessage = []; if (is_array($errors)) { foreach ($errors as $key => $value) { @@ -317,14 +317,14 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { $mapper = $this->controller->exportValue('MapField', 'mapper'); - $mapperKeys = array(); - $mapperLocTypes = array(); - $mapperPhoneTypes = array(); - $mapperRelated = array(); - $mapperRelatedContactType = array(); - $mapperRelatedContactDetails = array(); - $mapperRelatedContactLocType = array(); - $mapperRelatedContactPhoneType = array(); + $mapperKeys = []; + $mapperLocTypes = []; + $mapperPhoneTypes = []; + $mapperRelated = []; + $mapperRelatedContactType = []; + $mapperRelatedContactDetails = []; + $mapperRelatedContactLocType = []; + $mapperRelatedContactPhoneType = []; foreach ($mapper as $key => $value) { $mapperKeys[$key] = $mapper[$key][0]; @@ -375,7 +375,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); foreach ($mapper as $key => $value) { - $header = array(); + $header = []; list($id, $first, $second) = explode('_', $mapper[$key][0]); if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) { $relationType = new CRM_Contact_DAO_RelationshipType(); @@ -447,7 +447,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { } if (is_array($groups)) { - $groupAdditions = array(); + $groupAdditions = []; foreach ($groups as $groupId) { $addCount = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId); if (!empty($relatedContactIds)) { @@ -492,7 +492,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { if (is_array($tag)) { - $tagAdditions = array(); + $tagAdditions = []; foreach ($tag as $tagId => $val) { $addTagCount = CRM_Core_BAO_EntityTag::addContactsToTag($contactIds, $tagId); if (!empty($relatedContactIds)) { @@ -527,7 +527,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { $errorStack = CRM_Core_Error::singleton(); $errors = $errorStack->getErrors(); - $errorMessage = array(); + $errorMessage = []; if (is_array($errors)) { foreach ($errors as $key => $value) { diff --git a/CRM/Contact/Import/ImportJob.php b/CRM/Contact/Import/ImportJob.php index 043918db22..7940288294 100644 --- a/CRM/Contact/Import/ImportJob.php +++ b/CRM/Contact/Import/ImportJob.php @@ -42,7 +42,7 @@ class CRM_Contact_Import_ImportJob { protected $_allTags; protected $_mapper; - protected $_mapperKeys = array(); + protected $_mapperKeys = []; protected $_mapFields; protected $_parser; @@ -124,7 +124,7 @@ class CRM_Contact_Import_ImportJob { */ public function runImport(&$form, $timeout = 55) { $mapper = $this->_mapper; - $mapperFields = array(); + $mapperFields = []; $parserParameters = CRM_Contact_Import_Parser_Contact::getParameterForParser(count($mapper)); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); @@ -294,7 +294,7 @@ class CRM_Contact_Import_ImportJob { if ($newGroupName) { /* Create a new group */ - $newGroupType = $newGroupType ?? array(); + $newGroupType = $newGroupType ?? []; $gParams = array( 'title' => $newGroupName, 'description' => $newGroupDesc, @@ -306,7 +306,7 @@ class CRM_Contact_Import_ImportJob { } if (is_array($this->_groups)) { - $groupAdditions = array(); + $groupAdditions = []; foreach ($this->_groups as $groupId) { $addCount = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId); $totalCount = $addCount[1]; @@ -361,7 +361,7 @@ class CRM_Contact_Import_ImportJob { //add Tag to Import if (is_array($this->_tag)) { - $tagAdditions = array(); + $tagAdditions = []; foreach ($this->_tag as $tagId => $val) { $addTagCount = CRM_Core_BAO_EntityTag::addEntitiesToTag($contactIds, $tagId, 'civicrm_contact', FALSE); $totalTagCount = $addTagCount[1]; diff --git a/CRM/Contact/Page/View/Relationship.php b/CRM/Contact/Page/View/Relationship.php index ed03a112dd..c1d88ae79c 100644 --- a/CRM/Contact/Page/View/Relationship.php +++ b/CRM/Contact/Page/View/Relationship.php @@ -104,7 +104,7 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page { ); $session = CRM_Core_Session::singleton(); - $recentOther = array(); + $recentOther = []; if (($session->get('userID') == $this->getContactId()) || CRM_Contact_BAO_Contact_Permission::allow($this->getContactId(), CRM_Core_Permission::EDIT) diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index f411a21c42..7861eb1491 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -114,8 +114,8 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { $session->pushUserContext($url); $this->assignFieldMetadataToTemplate('Contact'); - $params = array(); - $defaults = array(); + $params = []; + $defaults = []; $params['id'] = $params['contact_id'] = $this->_contactId; $params['noRelationships'] = $params['noNotes'] = $params['noGroups'] = TRUE; @@ -218,7 +218,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { } // get contact name of shared contact names - $sharedAddresses = array(); + $sharedAddresses = []; $shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($defaults['address']); foreach ($defaults['address'] as $key => $addressValue) { if (!empty($addressValue['master_id']) && @@ -274,7 +274,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { */ public function getTemplateFileName() { if ($this->_contactId) { - $contactSubtypes = $this->get('contactSubtype') ? explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : array(); + $contactSubtypes = $this->get('contactSubtype') ? explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->get('contactSubtype')) : []; // there could be multiple subtypes. We check templates for each of the subtype, and return the first one found. foreach ($contactSubtypes as $csType) { diff --git a/CRM/Contact/Task.php b/CRM/Contact/Task.php index e4cac5e862..9498e45db2 100644 --- a/CRM/Contact/Task.php +++ b/CRM/Contact/Task.php @@ -262,12 +262,12 @@ class CRM_Contact_Task extends CRM_Core_Task { * @return array * set of tasks that are valid for the user */ - public static function permissionedTaskTitles($permission, $params = array()) { + public static function permissionedTaskTitles($permission, $params = []) { if (!isset($params['deletedContacts'])) { $params['deletedContacts'] = FALSE; } self::tasks(); - $tasks = array(); + $tasks = []; if ($params['deletedContacts']) { if (CRM_Core_Permission::check('access deleted contacts')) { $tasks[self::RESTORE] = self::$_tasks[self::RESTORE]['title']; diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index f902a049dd..e4708d5920 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -84,10 +84,10 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution * Default values */ public function setDefaultValues() { - $this->_defaults = array(); + $this->_defaults = []; if ($this->_subscriptionDetails->contact_id) { - $fields = array(); + $fields = []; $names = array( 'first_name', 'middle_name', @@ -170,7 +170,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution * true if no errors, else array of errors */ public static function formRule($fields, $files, $self) { - $errors = array(); + $errors = []; CRM_Core_Form::validateMandatoryFields($self->_fields, $fields, $errors); // validate the payment instrument values (e.g. credit card number) @@ -192,7 +192,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Contribute_Form_Contribution } $fields["email-{$this->_bltID}"] = 1; - $processorParams = array(); + $processorParams = []; foreach ($params as $key => $val) { $key = str_replace('billing_', '', $key); list($key) = explode('-', $key); diff --git a/CRM/Contribute/Page/ContributionPage.php b/CRM/Contribute/Page/ContributionPage.php index 56ae53b7e2..835089da89 100644 --- a/CRM/Contribute/Page/ContributionPage.php +++ b/CRM/Contribute/Page/ContributionPage.php @@ -411,14 +411,14 @@ AND cp.page_type = 'contribute' $this->search(); - $params = array(); + $params = []; $whereClause = $this->whereClause($params, FALSE); $config = CRM_Core_Config::singleton(); if ($config->includeAlphabeticalPager) { $this->pagerAToZ($whereClause, $params); } - $params = array(); + $params = []; $whereClause = $this->whereClause($params, TRUE); $this->pager($whereClause, $params); @@ -434,7 +434,7 @@ AND cp.page_type = 'contribute' ORDER BY is_active desc, title asc LIMIT $offset, $rowCount"; $contribPage = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Contribute_DAO_ContributionPage'); - $contribPageIds = array(); + $contribPageIds = []; while ($contribPage->fetch()) { $contribPageIds[$contribPage->id] = $contribPage->id; } @@ -457,7 +457,7 @@ ORDER BY is_active desc, title asc $configureActionLinks = self::configureActionLinks(); while ($dao->fetch()) { - $contribution[$dao->id] = array(); + $contribution[$dao->id] = []; CRM_Core_DAO::storeValues($dao, $contribution[$dao->id]); // form all action links @@ -485,7 +485,7 @@ ORDER BY is_active desc, title asc } //build the configure links. - $sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, array()); + $sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, []); $contribution[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo), $action, array('id' => $dao->id), @@ -565,7 +565,7 @@ ORDER BY is_active desc, title asc */ public function whereClause(&$params, $sortBy = TRUE) { // @todo Unused local variable can be safely removed. - $values = $clauses = array(); + $values = $clauses = []; $title = $this->get('title'); $createdId = $this->get('cid'); @@ -584,7 +584,7 @@ ORDER BY is_active desc, title asc } $value = $this->get('financial_type_id'); - $val = array(); + $val = []; if ($value) { if (is_array($value)) { foreach ($value as $k => $v) { @@ -627,7 +627,7 @@ ORDER BY is_active desc, title asc public function getCampaignIds() { // The unfiltered value from the session cannot be trusted, it needs to be // processed to get a clean array of positive integers. - $ids = array(); + $ids = []; foreach ((array) $this->get('campaign_id') as $id) { if ((string) (int) $id === (string) $id && $id > 0) { $ids[] = $id; @@ -695,7 +695,7 @@ ORDER BY UPPER(LEFT(title, 1)) } if (empty($sectionsInfo[$sectionName])) { - $classes = array(); + $classes = []; if (isset($link['class'])) { $classes = $link['class']; } diff --git a/CRM/Core/Action.php b/CRM/Core/Action.php index e24431a2ef..f147507602 100644 --- a/CRM/Core/Action.php +++ b/CRM/Core/Action.php @@ -312,7 +312,7 @@ class CRM_Core_Action { // make links indexed sequentially instead of by bitmask // otherwise it's next to impossible to reliably add new ones - $seqLinks = array(); + $seqLinks = []; foreach ($links as $bit => $link) { $link['bit'] = $bit; $seqLinks[] = $link; diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index a682676e74..826a18c45d 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -888,7 +888,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { case 'Autocomplete-Select': static $customUrls = []; // Fixme: why is this a string in the first place?? - $attributes = array(); + $attributes = []; if ($field->attributes) { foreach (explode(' ', $field->attributes) as $at) { if (strpos($at, '=')) { diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index 86a95fd080..e2ed3102e7 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -126,7 +126,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { * $note CRM_Core_BAO_Note object * @throws \CRM_Core_Exception */ - public static function add(&$params, $ids = array()) { + public static function add(&$params, $ids = []) { $dataExists = self::dataExists($params); if (!$dataExists) { return NULL; @@ -350,7 +350,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note { * */ public static function &getNote($id, $entityTable = 'civicrm_relationship') { - $viewNote = array(); + $viewNote = []; $query = " SELECT id, @@ -453,7 +453,7 @@ ORDER BY modified_date desc"; * @return array * Nested associative array beginning with direct children of given note. */ - private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = array(), $depth = 0) { + private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = [], $depth = 0) { if ($maxDepth && $depth > $maxDepth) { return FALSE; } @@ -517,7 +517,7 @@ ORDER BY modified_date desc"; * @return array * One-dimensional array containing ids of all desendent notes */ - public static function getDescendentIds($parentId, &$ids = array()) { + public static function getDescendentIds($parentId, &$ids = []) { // get direct children of given parentId note $note = new CRM_Core_DAO_Note(); $note->entity_table = 'civicrm_note'; diff --git a/CRM/Core/Block.php b/CRM/Core/Block.php index 2194e46882..bbd3b427f8 100644 --- a/CRM/Core/Block.php +++ b/CRM/Core/Block.php @@ -120,7 +120,7 @@ class CRM_Core_Block { 'template' => 'LangSwitch.tpl', 'info' => ts('CiviCRM Language Switcher'), 'subject' => '', - 'templateValues' => array(), + 'templateValues' => [], 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, @@ -133,7 +133,7 @@ class CRM_Core_Block { 'template' => 'Event.tpl', 'info' => ts('CiviCRM Upcoming Events'), 'subject' => ts('Upcoming Events'), - 'templateValues' => array(), + 'templateValues' => [], 'active' => TRUE, 'cache' => BLOCK_NO_CACHE, 'visibility' => 1, @@ -215,7 +215,7 @@ class CRM_Core_Block { */ public static function getInfo() { - $block = array(); + $block = []; foreach (self::properties() as $id => $value) { if ($value['active']) { if (in_array($id, array( @@ -328,7 +328,7 @@ class CRM_Core_Block { private static function setTemplateShortcutValues() { $config = CRM_Core_Config::singleton(); - static $shortCuts = array(); + static $shortCuts = []; if (!($shortCuts)) { if (CRM_Core_Permission::check('add contacts')) { @@ -397,7 +397,7 @@ class CRM_Core_Block { } } - $values = array(); + $values = []; foreach ($shortCuts as $key => $short) { $values[$key] = self::setShortCutValues($short); } @@ -431,7 +431,7 @@ class CRM_Core_Block { * @return array */ private static function setShortcutValues($short) { - $value = array(); + $value = []; if (isset($short['url'])) { $value['url'] = $short['url']; } @@ -452,7 +452,7 @@ class CRM_Core_Block { * Create the list of dashboard links. */ private static function setTemplateDashboardValues() { - static $dashboardLinks = array(); + static $dashboardLinks = []; if (CRM_Core_Permission::check('access Contact Dashboard')) { $dashboardLinks = array( array( @@ -467,9 +467,9 @@ class CRM_Core_Block { return NULL; } - $values = array(); + $values = []; foreach ($dashboardLinks as $dash) { - $value = array(); + $value = []; if (isset($dash['url'])) { $value['url'] = $dash['url']; } @@ -504,9 +504,9 @@ class CRM_Core_Block { ); } - $values = array(); + $values = []; foreach ($shortCuts as $short) { - $value = array(); + $value = []; $value['url'] = CRM_Utils_System::url($short['path'], $short['query']); $value['title'] = $short['title']; $values[] = $value; @@ -601,7 +601,7 @@ class CRM_Core_Block { return NULL; } - $block = array(); + $block = []; $block['name'] = 'block-civicrm'; $block['id'] = $block['name'] . '_' . $id; $block['subject'] = self::fetch($id, 'Subject.tpl', diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index bd9900df2f..390d6a2a7c 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -74,7 +74,7 @@ class CRM_Core_Menu { // lets call a hook and get any additional files if needed CRM_Utils_Hook::xmlMenu($files); - self::$_items = array(); + self::$_items = []; foreach ($files as $file) { self::read($file, self::$_items); } @@ -116,13 +116,13 @@ class CRM_Core_Menu { throw new CRM_Core_Exception('Unable to read XML file'); } $path = (string ) $item->path; - $menu[$path] = array(); + $menu[$path] = []; unset($item->path); if ($item->ids_arguments) { - $ids = array(); + $ids = []; foreach (array('json' => 'json', 'html' => 'html', 'exception' => 'exceptions') as $tag => $attr) { - $ids[$attr] = array(); + $ids[$attr] = []; foreach ($item->ids_arguments->{$tag} as $value) { $ids[$attr][] = (string) $value; } @@ -154,7 +154,7 @@ class CRM_Core_Menu { $elements = explode(';', $value); $op = 'or'; } - $items = array(); + $items = []; foreach ($elements as $element) { $items[] = $element; } @@ -216,7 +216,7 @@ class CRM_Core_Menu { 'page_arguments', 'is_ssl', ); - $fieldsPresent = array(); + $fieldsPresent = []; foreach ($fieldsToPropagate as $field) { $fieldsPresent[$field] = isset($menu[$path][$field]); } @@ -307,7 +307,7 @@ class CRM_Core_Menu { CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_menu', 'module_data', FALSE) ) { // Move unrecognized fields to $module_data. - $module_data = array(); + $module_data = []; foreach (array_keys($item) as $key) { if (!isset($daoFields[$key])) { $module_data[$key] = $item[$key]; @@ -341,7 +341,7 @@ class CRM_Core_Menu { * @param array $menu */ public static function buildAdminLinks(&$menu) { - $values = array(); + $values = []; foreach ($menu as $path => $item) { if (empty($item['adminGroup'])) { @@ -372,8 +372,8 @@ class CRM_Core_Menu { 'extra' => $item['extra'] ?? NULL, ); if (!array_key_exists($item['adminGroup'], $values)) { - $values[$item['adminGroup']] = array(); - $values[$item['adminGroup']]['fields'] = array(); + $values[$item['adminGroup']] = []; + $values[$item['adminGroup']]['fields'] = []; } $values[$item['adminGroup']]['fields']["{weight}.{$item['title']}"] = $value; $values[$item['adminGroup']]['component_id'] = $item['component_id']; @@ -416,7 +416,7 @@ class CRM_Core_Menu { * The breadcrumb for this path */ public static function buildBreadcrumb(&$menu, $path) { - $crumbs = array(); + $crumbs = []; $pathElements = explode('/', $path); array_pop($pathElements); @@ -506,7 +506,7 @@ class CRM_Core_Menu { * @throws \CRM_Core_Exception */ public static function fillComponentIds(&$menu, $path) { - static $cache = array(); + static $cache = []; if (array_key_exists('component_id', $menu[$path])) { return; @@ -551,7 +551,7 @@ class CRM_Core_Menu { $args = explode('/', $path); - $elements = array(); + $elements = []; while (!empty($args)) { $string = implode('/', $args); $string = CRM_Core_DAO::escapeString($string); @@ -587,10 +587,10 @@ UNION ( $menu = new CRM_Core_DAO_Menu(); $menu->query($query); - self::$_menuCache = array(); + self::$_menuCache = []; $menuPath = NULL; while ($menu->fetch()) { - self::$_menuCache[$menu->path] = array(); + self::$_menuCache[$menu->path] = []; CRM_Core_DAO::storeValues($menu, self::$_menuCache[$menu->path]); // Move module_data into main item. @@ -647,7 +647,7 @@ UNION ( if (!is_string($pathArgs)) { return; } - $args = array(); + $args = []; $elements = explode(',', $pathArgs); foreach ($elements as $keyVal) { @@ -656,7 +656,7 @@ UNION ( } if (array_key_exists('urlToSession', $arr)) { - $urlToSession = array(); + $urlToSession = []; $params = explode(';', $arr['urlToSession']); $count = 0; diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index efa71d4605..8e69eb560e 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -199,10 +199,10 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_isEventFull = $this->get('isEventFull'); $this->_lineItemParticipantsCount = $this->get('lineItemParticipants'); if (!is_array($this->_lineItem)) { - $this->_lineItem = array(); + $this->_lineItem = []; } if (!is_array($this->_lineItemParticipantsCount)) { - $this->_lineItemParticipantsCount = array(); + $this->_lineItemParticipantsCount = []; } $this->_availableRegistrations = $this->get('availableRegistrations'); $this->_participantIDS = $this->get('participantIDs'); @@ -232,7 +232,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } // get all the values from the dao object - $this->_values = $this->_fields = array(); + $this->_values = $this->_fields = []; //retrieve event information $params = array('id' => $this->_eventId); @@ -519,7 +519,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { if ($contactID) { //FIX CRM-9653 if (is_array($id)) { - $fields = array(); + $fields = []; foreach ($id as $profileID) { $field = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, @@ -643,7 +643,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } $eventFee = $form->_values['fee'] ?? NULL; if (!is_array($eventFee) || empty($eventFee)) { - $form->_values['fee'] = array(); + $form->_values['fee'] = []; } //fix for non-upgraded price sets.CRM-4256. @@ -876,7 +876,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $priceSetId = $form->get('priceSetId'); $addParticipantNum = substr($form->_name, 12); - $priceSetFields = $priceSetDetails = array(); + $priceSetFields = $priceSetDetails = []; $hasPriceFieldsCount = FALSE; if ($priceSetId) { $priceSetDetails = $form->get('priceSet'); @@ -975,7 +975,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $priceSetDetails = $form->get('priceSet'); foreach ($params as $key => & $value) { - $vals = array(); + $vals = []; if (strpos($key, 'price_') !== FALSE) { $fieldId = substr($key, 6); if (!array_key_exists($fieldId, $priceSetDetails['fields']) || @@ -1014,7 +1014,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $priceSet = $form->get('priceSet'); $priceSetId = $form->get('priceSetId'); - $optionsCount = array(); + $optionsCount = []; if (!$priceSetId || !is_array($priceSet) || empty($priceSet) || @@ -1024,7 +1024,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { return $optionsCount; } - $priceSetFields = $priceMaxFieldDetails = array(); + $priceSetFields = $priceMaxFieldDetails = []; if (!empty($priceSet['optionsCountTotal'])) { $priceSetFields = $priceSet['optionsCountDetails']['fields']; } @@ -1123,7 +1123,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { * @param array $optionFullIds * @param CRM_Core_Form $form */ - public static function resetElementValue($optionFullIds = array(), &$form) { + public static function resetElementValue($optionFullIds = [], &$form) { if (!is_array($optionFullIds) || empty($optionFullIds) || !$form->isSubmitted() @@ -1196,7 +1196,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { * @param array $optionIds * @param CRM_Core_Form $form */ - public static function resetSubmittedValue($elementName, $optionIds = array(), &$form) { + public static function resetSubmittedValue($elementName, $optionIds = [], &$form) { if (empty($elementName) || !$form->elementExists($elementName) || !$form->getSubmitValue($elementName) @@ -1247,7 +1247,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { * @return array */ public static function validatePriceSet(&$form, $params) { - $errors = array(); + $errors = []; $hasOptMaxValue = FALSE; if (!is_array($params) || empty($params)) { return $errors; @@ -1268,7 +1268,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { return $errors; } - $optionsCountDetails = $optionsMaxValueDetails = array(); + $optionsCountDetails = $optionsMaxValueDetails = []; if ( isset($priceSetDetails['optionsMaxValueTotal']) && $priceSetDetails['optionsMaxValueTotal'] @@ -1289,7 +1289,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $feeBlock = $priceSetDetails['fields']; } - $optionMaxValues = $fieldSelected = array(); + $optionMaxValues = $fieldSelected = []; foreach ($params as $pNum => $values) { if (!is_array($values) || $values == 'skip') { continue; @@ -1348,7 +1348,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { //validate for option max value. foreach ($optionMaxValues as $fieldId => $values) { - $options = CRM_Utils_Array::value('options', $feeBlock[$fieldId], array()); + $options = CRM_Utils_Array::value('options', $feeBlock[$fieldId], []); foreach ($values as $optId => $total) { $optMax = $optionsMaxValueDetails[$fieldId]['options'][$optId]; $opDbCount = CRM_Utils_Array::value('db_total_count', $options[$optId], 0); @@ -1383,7 +1383,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->_participantId = $participantID; $this->set('participantId', $this->_participantId); - $ids = $participantValues = array(); + $ids = $participantValues = []; $participantParams = array('id' => $this->_participantId); CRM_Event_BAO_Participant::getValues($participantParams, $participantValues, $ids); $this->_values['participant'] = $participantValues[$this->_participantId]; @@ -1486,14 +1486,14 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { */ public function processRegistration($params, $contactID = NULL) { $session = CRM_Core_Session::singleton(); - $this->_participantInfo = array(); + $this->_participantInfo = []; // CRM-4320, lets build array of cancelled additional participant ids // those are drop or skip by primary at the time of confirmation. // get all in and then unset those are confirmed. $cancelledIds = $this->_additionalParticipantIds; - $participantCount = array(); + $participantCount = []; foreach ($params as $participantNum => $record) { if ($record == 'skip') { $participantCount[$participantNum] = 'skip'; diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php index b418566f2b..f208534d4a 100644 --- a/CRM/Event/Import/Form/MapField.php +++ b/CRM/Event/Import/Form/MapField.php @@ -38,7 +38,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); $this->_onDuplicate = $this->get('onDuplicate'); - $highlightedFields = array(); + $highlightedFields = []; if ($skipColumnHeader) { $this->assign('skipColumnHeader', $skipColumnHeader); $this->assign('rowDisplayCount', 3); @@ -107,7 +107,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { //mapping is to be loaded from database $params = array('id' => $savedMapping); - $temp = array(); + $temp = []; $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp); $this->assign('loadedMapping', $mappingDetails->name); @@ -135,7 +135,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $this->addFormRule(array('CRM_Event_Import_Form_MapField', 'formRule'), $this); - $defaults = array(); + $defaults = []; $mapperKeys = array_keys($this->_mapperFields); $hasHeaders = !empty($this->_columnHeaders); $headerPatterns = $this->get('headerPatterns'); @@ -181,7 +181,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $jsSet = TRUE; } else { - $defaults["mapper[$i]"] = array(); + $defaults["mapper[$i]"] = []; } if (!$jsSet) { for ($k = 1; $k < 4; $k++) { @@ -276,12 +276,12 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { * list of errors to be posted back to the form */ public static function formRule($fields, $files, $self) { - $errors = array(); + $errors = []; // define so we avoid notices below $errors['_qf_default'] = ''; $fieldMessage = NULL; if (!array_key_exists('savedMapping', $fields)) { - $importKeys = array(); + $importKeys = []; foreach ($fields['mapper'] as $mapperPart) { $importKeys[] = $mapperPart[0]; } @@ -392,10 +392,10 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $seperator = $this->controller->exportValue('DataSource', 'fieldSeparator'); $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); - $mapperKeys = array(); - $mapper = array(); + $mapperKeys = []; + $mapper = []; $mapperKeys = $this->controller->exportValue($this->_name, 'mapper'); - $mapperKeysMain = array(); + $mapperKeysMain = []; for ($i = 0; $i < $this->_columnCount; $i++) { $mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]]; @@ -414,7 +414,7 @@ class CRM_Event_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingFields->mapping_id = $params['mappingId']; $mappingFields->find(); - $mappingFieldsId = array(); + $mappingFieldsId = []; while ($mappingFields->fetch()) { if ($mappingFields->id) { $mappingFieldsId[$mappingFields->column_number] = $mappingFields->id; diff --git a/CRM/Extension/Browser.php b/CRM/Extension/Browser.php index 89994cb00e..ff173a54a3 100644 --- a/CRM/Extension/Browser.php +++ b/CRM/Extension/Browser.php @@ -94,10 +94,10 @@ class CRM_Extension_Browser { */ public function checkRequirements() { if (!$this->isEnabled()) { - return array(); + return []; } - $errors = array(); + $errors = []; if (!$this->cacheDir || !is_dir($this->cacheDir) || !is_writable($this->cacheDir)) { $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1')); @@ -124,10 +124,10 @@ class CRM_Extension_Browser { */ public function getExtensions() { if (!$this->isEnabled() || count($this->checkRequirements())) { - return array(); + return []; } - $exts = array(); + $exts = []; $remote = $this->_discoverRemote(); if (is_array($remote)) { @@ -180,7 +180,7 @@ class CRM_Extension_Browser { $remotes = json_decode($this->grabCachedJson(), TRUE); } - $this->_remotesDiscovered = array(); + $this->_remotesDiscovered = []; foreach ((array) $remotes as $id => $xml) { $ext = CRM_Extension_Info::loadFromString($xml); $this->_remotesDiscovered[] = $ext; @@ -230,7 +230,7 @@ class CRM_Extension_Browser { if (FALSE === $this->getRepositoryUrl()) { // don't check if the user has configured civi not to check an external // url for extensions. See CRM-10575. - return array(); + return []; } $filename = $this->cacheDir . DIRECTORY_SEPARATOR . self::CACHE_JSON_FILE . '.' . md5($this->getRepositoryUrl()); diff --git a/CRM/Extension/Container/Default.php b/CRM/Extension/Container/Default.php index 04796ad933..f5a6c4ce3c 100644 --- a/CRM/Extension/Container/Default.php +++ b/CRM/Extension/Container/Default.php @@ -26,7 +26,7 @@ class CRM_Extension_Container_Default extends CRM_Extension_Container_Basic { * @return array */ public function checkRequirements() { - $errors = array(); + $errors = []; // In current configuration, we don't construct the default container // unless baseDir is set, so this error condition is more theoretical. diff --git a/CRM/Extension/Downloader.php b/CRM/Extension/Downloader.php index cc43c8be6e..a76ca105e1 100644 --- a/CRM/Extension/Downloader.php +++ b/CRM/Extension/Downloader.php @@ -49,7 +49,7 @@ class CRM_Extension_Downloader { * list of error messages; empty if OK */ public function checkRequirements($extensionInfo = NULL) { - $errors = array(); + $errors = []; if (!$this->containerDir || !is_dir($this->containerDir) || !is_writable($this->containerDir)) { $civicrmDestination = urlencode(CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1')); diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index fa3135f426..d0e6ac595d 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -102,7 +102,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { ); CRM_Utils_System::appendBreadCrumb($breadCrumb); - $this->_groupValues = array(); + $this->_groupValues = []; $params = array('id' => $this->_id); $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues); $this->_title = $this->_groupValues['title']; @@ -172,14 +172,14 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { * @return array */ public function setDefaultValues() { - $defaults = array(); + $defaults = []; if (isset($this->_id)) { $defaults = $this->_groupValues; if (!empty($defaults['group_type'])) { $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1) ); - $defaults['group_type'] = array(); + $defaults['group_type'] = []; foreach ($types as $type) { $defaults['group_type'][$type] = 1; } @@ -286,7 +286,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { * list of errors to be posted back to the form */ public static function formRule($fields, $fileParams, $options) { - $errors = array(); + $errors = []; $doParentCheck = $options['doParentCheck']; $self = &$options['selfObj']; @@ -360,7 +360,7 @@ WHERE title = %1 // CRM-21431 If all group_type are unchecked, the change will not be saved otherwise. if (!isset($params['group_type'])) { - $params['group_type'] = array(); + $params['group_type'] = []; } $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE); @@ -411,7 +411,7 @@ WHERE title = %1 */ public static function buildParentGroups(&$form) { $groupNames = CRM_Core_PseudoConstant::group(); - $parentGroups = $parentGroupElements = array(); + $parentGroups = $parentGroupElements = []; if (isset($form->_id) && !empty($form->_groupValues['parents'])) { $parentGroupIds = explode(',', $form->_groupValues['parents']); foreach ($parentGroupIds as $parentGroupId) { @@ -433,7 +433,7 @@ WHERE title = %1 $potentialParentGroupIds = array_keys($groupNames); } - $parentGroupSelectValues = array(); + $parentGroupSelectValues = []; foreach ($potentialParentGroupIds as $potentialParentGroupId) { if (array_key_exists($potentialParentGroupId, $groupNames)) { $parentGroupSelectValues[$potentialParentGroupId] = $groupNames[$potentialParentGroupId]; diff --git a/CRM/Mailing/Event/BAO/Bounce.php b/CRM/Mailing/Event/BAO/Bounce.php index f9056e6f79..57c8c3a99b 100644 --- a/CRM/Mailing/Event/BAO/Bounce.php +++ b/CRM/Mailing/Event/BAO/Bounce.php @@ -224,7 +224,7 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce { $dao->query($query); - $results = array(); + $results = []; while ($dao->fetch()) { $url = CRM_Utils_System::url('civicrm/contact/view', diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php index 1d537f7bcb..e7c110692f 100644 --- a/CRM/Member/Import/Form/MapField.php +++ b/CRM/Member/Import/Form/MapField.php @@ -47,7 +47,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); $this->_onDuplicate = $this->get('onDuplicate', $onDuplicate ?? ""); - $highlightedFields = array(); + $highlightedFields = []; if ($skipColumnHeader) { $this->assign('skipColumnHeader', $skipColumnHeader); $this->assign('rowDisplayCount', 3); @@ -120,7 +120,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { //mapping is to be loaded from database $params = array('id' => $savedMapping); - $temp = array(); + $temp = []; $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp); $this->assign('loadedMapping', $mappingDetails->name); @@ -150,7 +150,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { //-------- end of saved mapping stuff --------- - $defaults = array(); + $defaults = []; $mapperKeys = array_keys($this->_mapperFields); $hasHeaders = !empty($this->_columnHeaders); $headerPatterns = $this->get('headerPatterns'); @@ -198,7 +198,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $jsSet = TRUE; } else { - $defaults["mapper[$i]"] = array(); + $defaults["mapper[$i]"] = []; } if (!$jsSet) { for ($k = 1; $k < 4; $k++) { @@ -293,10 +293,10 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { * list of errors to be posted back to the form */ public static function formRule($fields, $files, $self) { - $errors = array(); + $errors = []; if (!array_key_exists('savedMapping', $fields)) { - $importKeys = array(); + $importKeys = []; foreach ($fields['mapper'] as $mapperPart) { $importKeys[] = $mapperPart[0]; } @@ -403,12 +403,12 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $seperator = $this->controller->exportValue('DataSource', 'fieldSeparator'); $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader'); - $mapperKeys = array(); - $mapper = array(); + $mapperKeys = []; + $mapper = []; $mapperKeys = $this->controller->exportValue($this->_name, 'mapper'); - $mapperKeysMain = array(); - $mapperLocType = array(); - $mapperPhoneType = array(); + $mapperKeysMain = []; + $mapperLocType = []; + $mapperPhoneType = []; for ($i = 0; $i < $this->_columnCount; $i++) { $mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]]; @@ -441,7 +441,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField { $mappingFields->mapping_id = $params['mappingId']; $mappingFields->find(); - $mappingFieldsId = array(); + $mappingFieldsId = []; while ($mappingFields->fetch()) { if ($mappingFields->id) { $mappingFieldsId[$mappingFields->column_number] = $mappingFields->id; diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php index 57fb30cda5..8ba2539c13 100644 --- a/CRM/Member/Page/DashBoard.php +++ b/CRM/Member/Page/DashBoard.php @@ -40,7 +40,7 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { } $this->assign('membershipSummary', TRUE); CRM_Utils_System::setTitle(ts('CiviMember')); - $membershipSummary = array(); + $membershipSummary = []; $preMonth = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); $preMonthEnd = date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 4fdc3ec5f6..1390af09f9 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -137,7 +137,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { $isRecalculatePledgePayment = self::isPaymentsRequireRecalculation($params); $transaction = new CRM_Core_Transaction(); - $paymentParams = array(); + $paymentParams = []; if (!empty($params['installment_amount'])) { $params['amount'] = $params['installment_amount'] * $params['installments']; } @@ -206,7 +206,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { "action=view&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home" ); - $recentOther = array(); + $recentOther = []; if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) { $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$pledge->id}&cid={$pledge->contact_id}&context=home" @@ -330,7 +330,7 @@ class CRM_Pledge_BAO_Pledge extends CRM_Pledge_DAO_Pledge { * @return array|null */ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) { - $where = array(); + $where = []; $select = $from = $queryDate = NULL; $statusId = CRM_Core_PseudoConstant::getKey('CRM_Pledge_BAO_Pledge', 'status_id', $status); @@ -365,7 +365,7 @@ GROUP BY currency $start = substr($startDate, 0, 8); $end = substr($endDate, 0, 8); $pCount = 0; - $pamount = array(); + $pamount = []; $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $pCount += $dao->pledge_count; @@ -380,7 +380,7 @@ GROUP BY currency ), ); - $where = array(); + $where = []; switch ($status) { case 'Completed': $select = 'sum( total_amount ) as received_pledge , count( cd.id ) as received_count'; @@ -428,7 +428,7 @@ GROUP BY currency "; if ($select) { $dao = CRM_Core_DAO::executeQuery($query); - $amount = array(); + $amount = []; $count = 0; while ($dao->fetch()) { @@ -462,7 +462,7 @@ GROUP BY currency * return the list of pledge fields */ public static function getHonorContacts($honorId) { - $params = array(); + $params = []; $honorDAO = new CRM_Contribute_DAO_ContributionSoft(); $honorDAO->contact_id = $honorId; $honorDAO->find(); @@ -506,7 +506,7 @@ GROUP BY currency */ public static function sendAcknowledgment(&$form, $params) { //handle Acknowledgment. - $allPayments = $payments = array(); + $allPayments = $payments = []; // get All Payments status types. $paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); @@ -516,7 +516,7 @@ GROUP BY currency if (!empty($allPayments)) { foreach ($allPayments as $payID => $values) { - $contributionValue = $contributionStatus = array(); + $contributionValue = $contributionStatus = []; if (isset($values['contribution_id'])) { $contributionParams = array('id' => $values['contribution_id']); $returnProperties = array('contribution_status_id', 'receive_date'); @@ -573,7 +573,7 @@ GROUP BY currency 'domain' => array('name', 'phone', 'address', 'email'), 'contact' => CRM_Core_SelectValues::contactTokens(), ); - $domainValues = array(); + $domainValues = []; foreach ($tokens['domain'] as $token) { $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain); } @@ -599,10 +599,10 @@ GROUP BY currency if (!empty($params['hidden_custom'])) { $groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', NULL, $params['id']); $pledgeParams = array(array('pledge_id', '=', $params['id'], 0, 0)); - $customGroup = array(); + $customGroup = []; // retrieve custom data foreach ($groupTree as $groupID => $group) { - $customFields = $customValues = array(); + $customFields = $customValues = []; if ($groupID == 'info') { continue; } @@ -708,7 +708,7 @@ GROUP BY currency public static function exportableFields($checkPermission = TRUE) { if (!self::$_exportableFields) { if (!self::$_exportableFields) { - self::$_exportableFields = array(); + self::$_exportableFields = []; } $fields = CRM_Pledge_DAO_Pledge::export(); @@ -773,12 +773,12 @@ GROUP BY currency * associated array of pledge id(s) */ public static function getContactPledges($contactID) { - $pledgeDetails = array(); + $pledgeDetails = []; $pledgeStatuses = CRM_Core_OptionGroup::values('pledge_status', FALSE, FALSE, FALSE, NULL, 'name' ); - $status = array(); + $status = []; // get pending and in progress status foreach (array( @@ -833,7 +833,7 @@ GROUP BY currency */ public static function updatePledgeStatus($params) { - $returnMessages = array(); + $returnMessages = []; $sendReminders = CRM_Utils_Array::value('send_reminders', $params, FALSE); @@ -881,7 +881,7 @@ SELECT pledge.contact_id as contact_id, $dao = CRM_Core_DAO::executeQuery($query); $now = date('Ymd'); - $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = array(); + $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = []; while ($dao->fetch()) { $checksumValue = CRM_Contact_BAO_Contact_Utils::generateChecksum($dao->contact_id); @@ -941,7 +941,7 @@ SELECT pledge.contact_id as contact_id, 'contact' => CRM_Core_SelectValues::contactTokens(), ); - $domainValues = array(); + $domainValues = []; foreach ($tokens['domain'] as $token) { $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain); } @@ -1100,7 +1100,7 @@ SELECT pledge.contact_id as contact_id, )); $paymentDAO->find(); - $paymentIDs = array(); + $paymentIDs = []; while ($paymentDAO->fetch()) { $paymentIDs[] = $paymentDAO->id; } @@ -1261,7 +1261,7 @@ SELECT pledge.contact_id as contact_id, * * @return array|bool */ - public static function buildOptions($fieldName, $context = NULL, $props = array()) { + public static function buildOptions($fieldName, $context = NULL, $props = []) { $result = parent::buildOptions($fieldName, $context, $props); if ($fieldName == 'status_id') { $result = array_diff($result, array('Failed')); diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index a3bac518b5..2672e631cf 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -119,7 +119,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { * @return array */ public static function getPledgeBlock($pageID) { - $pledgeBlock = array(); + $pledgeBlock = []; $dao = new CRM_Pledge_DAO_PledgeBlock(); $dao->entity_table = 'civicrm_contribution_page'; @@ -140,7 +140,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { //build pledge payment fields. if (!empty($form->_values['pledge_id'])) { //get all payments required details. - $allPayments = array(); + $allPayments = []; $returnProperties = array( 'status_id', 'scheduled_date', @@ -153,9 +153,9 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { // get all status $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - $nextPayment = array(); + $nextPayment = []; $isNextPayment = FALSE; - $overduePayments = array(); + $overduePayments = []; foreach ($allPayments as $payID => $value) { if ($allStatus[$value['status_id']] == 'Overdue') { $overduePayments[$payID] = array( @@ -184,7 +184,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { } // build check box array for payments. - $payments = array(); + $payments = []; if (!empty($overduePayments)) { foreach ($overduePayments as $id => $payment) { $label = ts("%1 - due on %2 (overdue)", array( @@ -236,7 +236,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { } // Frequency unit drop-down label suffixes switch from *ly to *(s) $freqUnitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $pledgeBlock['pledge_frequency_unit']); - $freqUnits = array(); + $freqUnits = []; $frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units'); foreach ($freqUnitVals as $key => $val) { if (array_key_exists($val, $frequencyUnits)) { @@ -247,7 +247,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { // CRM-18854 if (!empty($pledgeBlock['is_pledge_start_date_visible'])) { if (!empty($pledgeBlock['pledge_start_date'])) { - $defaults = array(); + $defaults = []; $date = (array) json_decode($pledgeBlock['pledge_start_date']); foreach ($date as $field => $value) { switch ($field) { diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php index a5496a5469..c3f9967b4e 100644 --- a/CRM/Report/Form/Campaign/SurveyDetails.php +++ b/CRM/Report/Form/Campaign/SurveyDetails.php @@ -42,7 +42,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { * say Q1, Q2 instead of the full title - to save space. * @var array */ - private $_columnTitleOverrides = array(); + private $_columnTitleOverrides = []; /** */ @@ -52,7 +52,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { public function __construct() { //filter options for survey activity status. $responseStatus = array('' => '- Any -'); - self::$_surveyRespondentStatus = array(); + self::$_surveyRespondentStatus = []; $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); if ($statusId = array_search('Scheduled', $activityStatus)) { $responseStatus[$statusId] = ts('Reserved'); @@ -64,10 +64,10 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { } $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name'); - $resultOptions = array(); + $resultOptions = []; foreach ($optionGroups as $gid => $name) { if ($name) { - $value = array(); + $value = []; $value = CRM_Core_OptionGroup::values($name); if (!empty($value)) { $value = array_combine($value, $value); @@ -221,12 +221,12 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { } public function select() { - $select = array(); + $select = []; //add the survey response fields. $this->_addSurveyResponseColumns(); - $this->_columnHeaders = array(); + $this->_columnHeaders = []; foreach ($this->_columns as $tableName => $table) { if (!isset($table['fields'])) { continue; @@ -302,7 +302,7 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { } public function where() { - $clauses = array(); + $clauses = []; foreach ($this->_columns as $tableName => $table) { if (array_key_exists('filters', $table)) { foreach ($table['filters'] as $fieldName => $field) { @@ -376,9 +376,9 @@ class CRM_Report_Form_Campaign_SurveyDetails extends CRM_Report_Form { return $coverSheet; } - $fieldIds = array(); + $fieldIds = []; - $surveyResponseFields = array(); + $surveyResponseFields = []; foreach ($this->_columns as $tableName => $values) { if (!is_array($values['fields'])) { continue; @@ -408,7 +408,7 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = field.option_gro WHERE field.id IN (' . implode(' , ', $fieldIds) . ' ) Order By val.weight'; $field = CRM_Core_DAO::executeQuery($query); - $options = array(); + $options = []; while ($field->fetch()) { $name = "custom_{$field->id}"; $surveyResponseFields[$name]['options'][$field->value] = $field->label; @@ -426,7 +426,7 @@ INNER JOIN civicrm_option_value val ON ( val.option_group_id = survey.result_id WHERE survey.id IN ( ' . implode(' , ', array_values($surveyIds)) . ' ) Order By val.weight'; $resultSet = CRM_Core_DAO::executeQuery($query); - $surveyResultFields = array(); + $surveyResultFields = []; while ($resultSet->fetch()) { $surveyResultFields[$resultSet->id]['title'] = $resultSet->title; $surveyResultFields[$resultSet->id]['options'][$resultSet->value] = $resultSet->label; @@ -518,7 +518,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) Order By val.weight'; $result = CRM_Core_DAO::executeQuery($query); - $resultSet = array(); + $resultSet = []; while ($result->fetch()) { $resultSet[$result->id][$result->value] = $result->label; } @@ -531,7 +531,7 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) if (!empty($row['civicrm_activity_survey_id'])) { $surveyId = $row['civicrm_activity_survey_id']; } - $result = CRM_Utils_Array::value($surveyId, $resultSet, array()); + $result = CRM_Utils_Array::value($surveyId, $resultSet, []); $resultLabel = $row['civicrm_activity_result'] ?? NULL; if ($respondentStatus == 'Reserved') { $row['civicrm_activity_result'] = implode(' | ', array_keys($result)); @@ -556,8 +556,8 @@ INNER JOIN civicrm_survey survey ON ( survey.result_id = grp.id ) return; } - $surveyResponseFields = array(); - $surveyResponseFieldIds = array(); + $surveyResponseFields = []; + $surveyResponseFieldIds = []; foreach ($this->_columns as $tableName => $values) { if (!is_array($values['fields'])) { continue; @@ -610,8 +610,8 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) WHERE cf.id IN ( ' . implode(' , ', $surveyResponseFieldIds) . ' ) Order By ov.weight'; - $responseFields = array(); - $fieldValueMap = array(); + $responseFields = []; + $fieldValueMap = []; $properties = array( 'id', 'data_type', @@ -656,7 +656,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) in_array($this->_outputMode, array('print', 'pdf')) ) { $optGrpId = $responseFields[$name]['option_group_id'] ?? NULL; - $options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, array()); + $options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, []); $value = implode(' | ', array_keys($options)); } else { @@ -678,7 +678,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) return; } - $responseFields = array(); + $responseFields = []; foreach ($surveyIds as $surveyId) { $responseFields += CRM_Campaign_BAO_Survey::getSurveyResponseFields($surveyId); $this->_surveyResponseFields = $responseFields; @@ -702,7 +702,7 @@ INNER JOIN civicrm_custom_group cg ON ( cg.id = cf.custom_group_id ) $this->_locationBasedPhoneField = TRUE; } } - $responseFieldIds = array(); + $responseFieldIds = []; foreach (array_keys($responseFields) as $key) { $cfId = CRM_Core_BAO_CustomField::getKeyID($key); if ($cfId) { diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index 485f4d814f..c920b08f7d 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -134,7 +134,7 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { * @return array */ public static function formRule($fields, $files, $self) { - $errors = $grouping = array(); + $errors = $grouping = []; return $errors; } @@ -156,7 +156,7 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { $sql = $this->buildQuery(TRUE); - $rows = $graphRows = array(); + $rows = $graphRows = []; $this->buildRows($sql, $rows); $this->formatDisplay($rows); diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index 7b66f28d6d..aa4846c532 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -244,7 +244,7 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { * Override parent select for reasons someone will someday make sense of & document. */ public function select() { - $select = array(); + $select = []; $append = NULL; // since contact fields not related to financial type if (array_key_exists('financial_type', $this->_params['group_bys']) || @@ -409,7 +409,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 } if (!$this->_amountClauseWithAND) { - $amountClauseWithAND = array(); + $amountClauseWithAND = []; if (!empty($clauses['total_amount1'])) { $amountClauseWithAND[] = str_replace("{$this->_aliases['civicrm_contribution']}.total_amount", "{$this->_aliases['civicrm_contribution']}1.total_amount_sum", $clauses['total_amount1']); @@ -478,7 +478,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 */ public static function formRule($fields, $files, $self) { - $errors = $checkDate = $errorCount = array(); + $errors = $checkDate = $errorCount = []; $rules = array( 'id' => array( @@ -558,7 +558,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 foreach ($fields['fields'] as $fld_id => $value) { if (!($fld_id == 'total_amount1') && !($fld_id == 'total_amount2') && !(substr($fld_id, 0, 7) === "custom_")) { $found = FALSE; - $invlidGroups = array(); + $invlidGroups = []; foreach ($fields['group_bys'] as $grp_id => $val) { $validFields = $rules[$grp_id]; if (in_array($fld_id, $validFields)) { @@ -671,7 +671,7 @@ LEFT JOIN $this->tempTableRepeat2 {$this->_aliases['civicrm_contribution']}2 $sql = "{$this->_select} {$this->_from} {$this->_where}"; $dao = $this->executeReportQuery($sql); //store contributions in array 'contact_sums' for comparison - $contact_sums = array(); + $contact_sums = []; while ($dao->fetch()) { $contact_sums[$dao->contact_civireport_id] = array( 'contribution1_total_amount_sum' => $dao->contribution1_total_amount_sum, @@ -753,7 +753,7 @@ GROUP BY currency "; $dao = $this->executeReportQuery($sql); - $amount = $average = $amount2 = $average2 = array(); + $amount = $average = $amount2 = $average2 = []; $count = $count2 = 0; while ($dao->fetch()) { if ($dao->amount) { @@ -824,7 +824,7 @@ GROUP BY currency $count = 0; $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_orderBy} {$this->_limit}"; $dao = $this->executeReportQuery($sql); - $rows = array(); + $rows = []; while ($dao->fetch()) { foreach ($this->_columnHeaders as $key => $value) { $rows[$count][$key] = $dao->$key; diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index 50175c9aaf..c465fb6f85 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -404,7 +404,7 @@ WHERE ce.entity_table = 'civicrm_event' ORDER BY cv.label "; $dao = CRM_Core_DAO::executeQuery($query); - $elements = array(); + $elements = []; while ($dao->fetch()) { $elements[$dao->id] = "$dao->label\n"; } @@ -417,8 +417,8 @@ ORDER BY cv.label } public function select() { - $select = array(); - $this->_columnHeaders = array(); + $select = []; + $this->_columnHeaders = []; //add blank column at the Start if (array_key_exists('options', $this->_params) && @@ -475,7 +475,7 @@ ORDER BY cv.label * @return array */ public static function formRule($fields, $files, $self) { - $errors = $grouping = array(); + $errors = $grouping = []; return $errors; } @@ -530,7 +530,7 @@ ORDER BY cv.label } public function where() { - $clauses = array(); + $clauses = []; foreach ($this->_columns as $tableName => $table) { if (array_key_exists('filters', $table)) { foreach ($table['filters'] as $fieldName => $field) { @@ -673,7 +673,7 @@ ORDER BY cv.label $roleId = $row['civicrm_participant_role_id']; if ($roleId) { $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $roleId); - $roleId = array(); + $roleId = []; foreach ($roles as $role) { $roleId[$role] = CRM_Event_PseudoConstant::participantRole($role, FALSE); } diff --git a/CRM/SMS/Page/Provider.php b/CRM/SMS/Page/Provider.php index f8f4ad4e37..9122dca44e 100644 --- a/CRM/SMS/Page/Provider.php +++ b/CRM/SMS/Page/Provider.php @@ -112,7 +112,7 @@ class CRM_SMS_Page_Provider extends CRM_Core_Page_Basic { */ public function browse($action = NULL) { $providers = CRM_SMS_BAO_Provider::getProviders(); - $rows = array(); + $rows = []; foreach ($providers as $provider) { $action = array_sum(array_keys($this->links())); // update enable/disable links. diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php index 387092876d..896302ea13 100644 --- a/CRM/SMS/Provider.php +++ b/CRM/SMS/Provider.php @@ -22,7 +22,7 @@ abstract class CRM_SMS_Provider { * * @var object */ - static private $_singleton = array(); + static private $_singleton = []; const MAX_SMS_CHAR = 460; /** @@ -34,7 +34,7 @@ abstract class CRM_SMS_Provider { * @return object * @throws CRM_Core_Exception */ - public static function &singleton($providerParams = array(), $force = FALSE) { + public static function &singleton($providerParams = [], $force = FALSE) { $mailingID = $providerParams['mailing_id'] ?? NULL; $providerID = $providerParams['provider_id'] ?? NULL; $providerName = $providerParams['provider'] ?? NULL; @@ -125,7 +125,7 @@ abstract class CRM_SMS_Provider { * @return self|null|object * @throws CRM_Core_Exception */ - public function createActivity($apiMsgID, $message, $headers = array(), $jobID = NULL, $userID = NULL) { + public function createActivity($apiMsgID, $message, $headers = [], $jobID = NULL, $userID = NULL) { if ($jobID) { $sql = " SELECT scheduled_id FROM civicrm_mailing m diff --git a/Civi.php b/Civi.php index e52dd16148..95009e35c3 100644 --- a/Civi.php +++ b/Civi.php @@ -23,7 +23,7 @@ class Civi { * `Civi::$statics[__CLASS__]['foo'] = 'bar'; * ``` */ - public static $statics = array(); + public static $statics = []; /** * Retrieve a named cache instance. @@ -106,7 +106,7 @@ class Civi { * singletons, containers. */ public static function reset() { - self::$statics = array(); + self::$statics = []; Civi\Core\Container::singleton(); } diff --git a/Civi/Core/Themes.php b/Civi/Core/Themes.php index 8e7dc5988d..9156eb5558 100644 --- a/Civi/Core/Themes.php +++ b/Civi/Core/Themes.php @@ -133,7 +133,7 @@ class Themes { * @see CRM_Utils_Hook::themes */ public function getAvailable() { - $result = array(); + $result = []; foreach ($this->getAll() as $key => $theme) { if ($key{0} !== '_') { $result[$key] = $theme['title']; @@ -164,14 +164,14 @@ class Themes { public function resolveUrls($active, $cssExt, $cssFile) { $all = $this->getAll(); if (!isset($all[$active])) { - return array(); + return []; } $cssId = $this->cssId($cssExt, $cssFile); foreach ($all[$active]['search_order'] as $themeKey) { if (isset($all[$themeKey]['excludes']) && in_array($cssId, $all[$themeKey]['excludes'])) { - $result = array(); + $result = []; } else { $result = Civi\Core\Resolver::singleton() diff --git a/Civi/Test/DbTestTrait.php b/Civi/Test/DbTestTrait.php index 74388ada0f..866984566f 100644 --- a/Civi/Test/DbTestTrait.php +++ b/Civi/Test/DbTestTrait.php @@ -154,7 +154,7 @@ trait DbTestTrait { */ public function assertDBCompareValues($daoName, $searchParams, $expectedValues) { //get the values from db - $dbValues = array(); + $dbValues = []; \CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues); // compare db values with expected values diff --git a/Civi/Test/GenericAssertionsTrait.php b/Civi/Test/GenericAssertionsTrait.php index 0d53d034ba..8d04b6359b 100644 --- a/Civi/Test/GenericAssertionsTrait.php +++ b/Civi/Test/GenericAssertionsTrait.php @@ -35,8 +35,8 @@ trait GenericAssertionsTrait { * @param array $actual */ public function assertTreeEquals($expected, $actual) { - $e = array(); - $a = array(); + $e = []; + $a = []; \CRM_Utils_Array::flatten($expected, $e, '', ':::'); \CRM_Utils_Array::flatten($actual, $a, '', ':::'); ksort($e); diff --git a/Civi/Test/MailingTestTrait.php b/Civi/Test/MailingTestTrait.php index 6609750fbe..b6ee14d872 100644 --- a/Civi/Test/MailingTestTrait.php +++ b/Civi/Test/MailingTestTrait.php @@ -18,7 +18,7 @@ trait MailingTestTrait { * * @return int */ - public function createMailing($params = array()) { + public function createMailing($params = []) { $params = array_merge(array( 'subject' => 'maild' . rand(), 'body_text' => 'bdkfhdskfhduew{domain.address}{action.optOutUrl}', diff --git a/install/civicrm.php b/install/civicrm.php index 0932b1902b..ed2df94303 100644 --- a/install/civicrm.php +++ b/install/civicrm.php @@ -200,7 +200,7 @@ function civicrm_config(&$config) { global $tplPath, $installType; // Ex: $extraSettings[] = '$civicrm_settings["domain"]["foo"] = "bar";'; - $extraSettings = array(); + $extraSettings = []; $params = array( 'crmRoot' => $crmPath, diff --git a/tests/extensions/test.extension.manager.paymenttest/main.php b/tests/extensions/test.extension.manager.paymenttest/main.php index 313db799b1..37da996ff4 100644 --- a/tests/extensions/test.extension.manager.paymenttest/main.php +++ b/tests/extensions/test.extension.manager.paymenttest/main.php @@ -5,7 +5,7 @@ */ class test_extension_manager_paymenttest extends CRM_Core_Payment { - public static $counts = array(); + public static $counts = []; public function install() { self::$counts['install'] = self::$counts['install'] ?? 0; diff --git a/tests/extensions/test.extension.manager.searchtest/main.php b/tests/extensions/test.extension.manager.searchtest/main.php index 0611cae2d0..b1f58e4d2a 100644 --- a/tests/extensions/test.extension.manager.searchtest/main.php +++ b/tests/extensions/test.extension.manager.searchtest/main.php @@ -131,11 +131,11 @@ class test_extension_manager_searchtest extends CRM_Contact_Form_Search_Custom_B * @return string, sql fragment with conditional expressions */ public function where($includeContactIDs = FALSE) { - $params = array(); + $params = []; $where = "contact_a.contact_type = 'Household'"; $count = 1; - $clause = array(); + $clause = []; $name = CRM_Utils_Array::value('household_name', $this->_formValues ); diff --git a/tests/phpunit/CiviTest/CiviDBAssert.php b/tests/phpunit/CiviTest/CiviDBAssert.php index 88b8bcd4d8..0174795c06 100644 --- a/tests/phpunit/CiviTest/CiviDBAssert.php +++ b/tests/phpunit/CiviTest/CiviDBAssert.php @@ -150,7 +150,7 @@ class CiviDBAssert { */ public function assertDBCompareValues(&$testCase, $daoName, $searchParams, $expectedValues) { //get the values from db - $dbValues = array(); + $dbValues = []; CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues); // compare db values with expected values diff --git a/tests/phpunit/CiviTest/CiviMailUtils.php b/tests/phpunit/CiviTest/CiviMailUtils.php index ec1c66579e..d7836fc8ab 100644 --- a/tests/phpunit/CiviTest/CiviMailUtils.php +++ b/tests/phpunit/CiviTest/CiviMailUtils.php @@ -233,7 +233,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase { * * @return \ezcMail|string */ - public function checkMailLog($strings, $absentStrings = array(), $prefix = '') { + public function checkMailLog($strings, $absentStrings = [], $prefix = '') { $mail = $this->getMostRecentEmail('raw'); return $this->checkMailForStrings($strings, $absentStrings, $prefix, $mail); } @@ -249,7 +249,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase { * * @return \ezcMail|string */ - public function checkAllMailLog($strings, $absentStrings = array(), $prefix = '') { + public function checkAllMailLog($strings, $absentStrings = [], $prefix = '') { $mails = $this->getAllMessages('raw'); $mail = implode(',', $mails); return $this->checkMailForStrings($strings, $absentStrings, $prefix, $mail); @@ -271,7 +271,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase { * Array($msgPos => array($recipPos => $emailAddr)). */ public function assertRecipients($expectedRecipients) { - $recipients = array(); + $recipients = []; foreach ($this->getAllMessages('ezc') as $message) { $recipients[] = CRM_Utils_Array::collect('email', $message->to); } @@ -297,7 +297,7 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase { * Array(string $subj). */ public function assertSubjects($expectedSubjects) { - $subjects = array(); + $subjects = []; foreach ($this->getAllMessages('ezc') as $message) { /** @var ezcMail $message */ $subjects[] = $message->subject; diff --git a/tests/phpunit/CiviTest/CiviReportTestCase.php b/tests/phpunit/CiviTest/CiviReportTestCase.php index f9ac63d21d..855ff29aef 100644 --- a/tests/phpunit/CiviTest/CiviReportTestCase.php +++ b/tests/phpunit/CiviTest/CiviReportTestCase.php @@ -66,7 +66,7 @@ class CiviReportTestCase extends CiviUnitTestCase { $reportName = array_pop($tmpReportVal); $reportObj =& $controller->_pages[$reportName]; - $tmpGlobals = array(); + $tmpGlobals = []; $tmpGlobals['_REQUEST']['force'] = 1; $tmpGlobals['_GET'][$config->userFrameworkURLVar] = 'civicrm/placeholder'; $tmpGlobals['_SERVER']['QUERY_STRING'] = ''; @@ -107,7 +107,7 @@ class CiviReportTestCase extends CiviUnitTestCase { * @return array */ public function getArrayFromCsv($csvFile) { - $arrFile = array(); + $arrFile = []; if (($handle = fopen($csvFile, "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $arrFile[] = $data; diff --git a/tests/phpunit/CiviTest/CiviTestSMSProvider.php b/tests/phpunit/CiviTest/CiviTestSMSProvider.php index db73e2a5ad..a9850bc4a0 100644 --- a/tests/phpunit/CiviTest/CiviTestSMSProvider.php +++ b/tests/phpunit/CiviTest/CiviTestSMSProvider.php @@ -13,15 +13,15 @@ * Test SMS provider to allow for testing */ class CiviTestSMSProvider extends CRM_SMS_Provider { - protected $_providerInfo = array(); + protected $_providerInfo = []; protected $_id = 0; - static private $_singleton = array(); + static private $_singleton = []; public function __construct($provider, $skipAuth = TRUE) { $this->provider = $provider; } - public static function &singleton($providerParams = array(), $force = FALSE) { + public static function &singleton($providerParams = [], $force = FALSE) { if (isset($providerParams['provider'])) { $providers = CRM_SMS_BAO_Provider::getProviders(NULL, array('name' => $providerParams['provider'])); $provider = current($providers); @@ -34,7 +34,7 @@ class CiviTestSMSProvider extends CRM_SMS_Provider { $cacheKey = (int) $providerID; if (!isset(self::$_singleton[$cacheKey]) || $force) { - $provider = array(); + $provider = []; if ($providerID) { $provider = CRM_SMS_BAO_Provider::getProviderInfo($providerID); } diff --git a/tests/phpunit/CiviTest/CiviTestSuite.php b/tests/phpunit/CiviTest/CiviTestSuite.php index df8cf92d75..25567a40e6 100644 --- a/tests/phpunit/CiviTest/CiviTestSuite.php +++ b/tests/phpunit/CiviTest/CiviTestSuite.php @@ -120,7 +120,7 @@ class CiviTestSuite extends PHPUnit\Framework\TestSuite { // Pass 1: Check all *Tests.php files // array(callable) - $addTests = array(); + $addTests = []; //echo "start Pass 1 on {$dirInfo->getRealPath()}\n"; $dir = new DirectoryIterator($dirInfo->getRealPath()); foreach ($dir as $fileInfo) { @@ -157,7 +157,7 @@ class CiviTestSuite extends PHPUnit\Framework\TestSuite { // Pass 2: Scan all subdirectories // array(array(0 => $suite, 1 => $file, 2 => SplFileinfo)) - $addAllTests = array(); + $addAllTests = []; $dir = new DirectoryIterator($dirInfo->getRealPath()); //echo "start Pass 2 on {$dirInfo->getRealPath()}\n"; foreach ($dir as $fileInfo) { @@ -179,7 +179,7 @@ class CiviTestSuite extends PHPUnit\Framework\TestSuite { // Pass 3: Check all *Test.php files in this directory //echo "start Pass 3 on {$dirInfo->getRealPath()}\n"; // array(className) - $addTestSuites = array(); + $addTestSuites = []; $dir = new DirectoryIterator($dirInfo->getRealPath()); foreach ($dir as $fileInfo) { if ($fileInfo->isReadable() && $fileInfo->isFile() diff --git a/tests/phpunit/E2E/Core/AssetBuilderTest.php b/tests/phpunit/E2E/Core/AssetBuilderTest.php index 03c8d67bd4..aa282d6b66 100644 --- a/tests/phpunit/E2E/Core/AssetBuilderTest.php +++ b/tests/phpunit/E2E/Core/AssetBuilderTest.php @@ -69,7 +69,7 @@ class AssetBuilderTest extends \CiviEndToEndTestCase { * @return array */ public function getExamples() { - $examples = array(); + $examples = []; $examples[] = array( 0 => 'square.txt', diff --git a/tests/phpunit/E2E/Extern/RestTest.php b/tests/phpunit/E2E/Extern/RestTest.php index d616c0512c..22fbaedd3f 100644 --- a/tests/phpunit/E2E/Extern/RestTest.php +++ b/tests/phpunit/E2E/Extern/RestTest.php @@ -43,7 +43,7 @@ class E2E_Extern_RestTest extends CiviEndToEndTestCase { $this->markTestSkipped('Missing siteKey'); } - $this->old_api_keys = array(); + $this->old_api_keys = []; } protected function getRestUrl() { @@ -78,7 +78,7 @@ class E2E_Extern_RestTest extends CiviEndToEndTestCase { * @return array; each item is a list of parameters for testAPICalls */ public function apiTestCases() { - $cases = array(); + $cases = []; // entity,action: omit apiKey, valid entity+action $cases[] = array( diff --git a/tests/phpunit/E2E/Extern/SoapTest.php b/tests/phpunit/E2E/Extern/SoapTest.php index 9aab42b644..530839337d 100644 --- a/tests/phpunit/E2E/Extern/SoapTest.php +++ b/tests/phpunit/E2E/Extern/SoapTest.php @@ -63,7 +63,7 @@ class E2E_Extern_SoapTest extends CiviEndToEndTestCase { public function testAuthenticationBadKey() { $client = $this->createClient(); $key = $client->authenticate($this->adminUser, $this->adminPass); - $client->get_contact(mt_rand(), array()); + $client->get_contact(mt_rand(), []); } /** -- 2.25.1