Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Autoformat php short array syntax #26724

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions CRM/Campaign/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function preProcess() {
//operation for state machine.
$this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve');
//validate operation.
if (!in_array($this->_operation, array(
if (!in_array($this->_operation, [
'reserve',
'release',
'interview',
))
])
) {
$this->_operation = 'reserve';
$this->set('op', $this->_operation);
Expand Down Expand Up @@ -139,11 +139,11 @@ public function preProcess() {
//append breadcrumb to survey dashboard.
if (CRM_Campaign_BAO_Campaign::accessCampaign()) {
$url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url)));
CRM_Utils_System::appendBreadCrumb([['title' => ts('Survey(s)'), 'url' => $url]]);
}

//set the form title.
$this->setTitle(ts('Find Respondents To %1', array(1 => ucfirst($this->_operation))));
$this->setTitle(ts('Find Respondents To %1', [1 => ucfirst($this->_operation)]));
}

/**
Expand Down Expand Up @@ -179,26 +179,26 @@ public function buildQuickForm() {
$allTasks = CRM_Campaign_Task::permissionedTaskTitles(CRM_Core_Permission::getPermission());

//hack to serve right page to state machine.
$taskMapping = array(
$taskMapping = [
'interview' => CRM_Campaign_Task::INTERVIEW,
'reserve' => CRM_Campaign_Task::RESERVE,
'release' => CRM_Campaign_Task::RELEASE,
);
];

$currentTaskValue = $taskMapping[$this->_operation] ?? NULL;
$taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]);
$taskValue = [$currentTaskValue => $allTasks[$currentTaskValue]];
if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) {
$activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);

$surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey',
$this->_formValues['campaign_survey_id'],
'activity_type_id'
);
$taskValue = array(
$taskValue = [
$currentTaskValue => ts('Record %1 Responses',
array(1 => $activityTypes[$surveyTypeId])
[1 => $activityTypes[$surveyTypeId]]
),
);
];
}

$this->addTaskMenu($taskValue);
Expand Down Expand Up @@ -293,7 +293,7 @@ public function formatParams() {
}

//format multi-select group and contact types.
foreach (array('group', 'contact_type') as $param) {
foreach (['group', 'contact_type'] as $param) {
if ($this->_force) {
continue;
}
Expand Down Expand Up @@ -401,12 +401,12 @@ public function fixFormValues() {
* @return array
*/
public function voterClause() {
$params = array('campaign_search_voter_for' => $this->_operation);
$params = ['campaign_search_voter_for' => $this->_operation];

$clauseFields = array(
$clauseFields = [
'surveyId' => 'campaign_survey_id',
'interviewerId' => 'survey_interviewer_id',
);
];

foreach ($clauseFields as $param => $key) {
$params[$key] = $this->_formValues[$key] ?? NULL;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Audit/AuditConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function sort(&$f, $r) {
}

$this->sortRegion = $r;
uasort($f, array(&$this, "compareFields"));
uasort($f, [&$this, "compareFields"]);
}

/**
Expand Down
42 changes: 21 additions & 21 deletions CRM/Contribute/Form/UpdateBilling.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function setDefaultValues() {

if ($this->getSubscriptionDetails()->contact_id) {
$fields = [];
$names = array(
$names = [
'first_name',
'middle_name',
'last_name',
Expand All @@ -96,7 +96,7 @@ public function setDefaultValues() {
"postal_code-{$this->_bltID}",
"country_id-{$this->_bltID}",
"state_province_id-{$this->_bltID}",
);
];
foreach ($names as $name) {
$fields[$name] = 1;
}
Expand Down Expand Up @@ -139,20 +139,20 @@ public function buildQuickForm() {
$type = 'submit';
}

$this->addButtons(array(
array(
$this->addButtons([
[
'type' => $type,
'name' => ts('Save'),
'isDefault' => TRUE,
),
array(
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
),
));
],
]);

CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, TRUE, TRUE);
$this->addFormRule(array('CRM_Contribute_Form_UpdateBilling', 'formRule'), $this);
$this->addFormRule(['CRM_Contribute_Form_UpdateBilling', 'formRule'], $this);
}

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ public function postProcess() {

// build tpl params
if ($this->getSubscriptionDetails()->membership_id) {
$inputParams = array('id' => $this->getSubscriptionDetails()->membership_id);
$inputParams = ['id' => $this->getSubscriptionDetails()->membership_id];
CRM_Member_BAO_Membership::getValues($inputParams, $tplParams);
$tplParams = $tplParams[$this->getSubscriptionDetails()->membership_id];
$tplParams['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']);
Expand All @@ -234,24 +234,24 @@ public function postProcess() {
}
else {
$status = ts('Billing details for the recurring contribution of %1, every %2 %3 have been updated.',
array(
[
1 => $this->getSubscriptionDetails()->amount,
2 => $this->getSubscriptionDetails()->frequency_interval,
3 => $this->getSubscriptionDetails()->frequency_unit,
)
]
);
$msgTitle = ts('Details Updated');
$msgType = 'success';

$tplParams = array(
$tplParams = [
'recur_frequency_interval' => $this->getSubscriptionDetails()->frequency_interval,
'recur_frequency_unit' => $this->getSubscriptionDetails()->frequency_unit,
'amount' => $this->getSubscriptionDetails()->amount,
);
];
}

// format new address for display
$addressParts = array("street_address", "city", "postal_code", "state_province", "country");
$addressParts = ["street_address", "city", "postal_code", "state_province", "country"];
foreach ($addressParts as $part) {
$addressParts[$part] = $processorParams[$part] ?? NULL;
}
Expand All @@ -260,7 +260,7 @@ public function postProcess() {
// format old address to store in activity details
$this->_defaults["state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvince($this->_defaults["state_province-{$this->_bltID}"], FALSE);
$this->_defaults["country-{$this->_bltID}"] = CRM_Core_PseudoConstant::country($this->_defaults["country-{$this->_bltID}"], FALSE);
$addressParts = array("street_address", "city", "postal_code", "state_province", "country");
$addressParts = ["street_address", "city", "postal_code", "state_province", "country"];
foreach ($addressParts as $part) {
$key = "{$part}-{$this->_bltID}";
$addressParts[$part] = $this->_defaults[$key] ?? NULL;
Expand Down Expand Up @@ -296,7 +296,7 @@ public function postProcess() {
<br/>{$this->_defaults['billingName']}
<br/>{$this->_defaults['address']}";

$activityParams = array(
$activityParams = [
'source_contact_id' => $this->getSubscriptionDetails()->contact_id,
'activity_type_id' => CRM_Core_PseudoConstant::getKey(
'CRM_Activity_BAO_Activity',
Expand All @@ -307,7 +307,7 @@ public function postProcess() {
'details' => $message,
'activity_date_time' => date('YmdHis'),
'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'),
);
];
$session = CRM_Core_Session::singleton();
$cid = $session->get('userID');
if ($cid) {
Expand All @@ -317,11 +317,11 @@ public function postProcess() {
CRM_Activity_BAO_Activity::create($activityParams);

list($donorDisplayName, $donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->getSubscriptionDetails()->contact_id);
$tplParams['contact'] = array('display_name' => $donorDisplayName);
$tplParams['contact'] = ['display_name' => $donorDisplayName];

$tplParams = array_merge($tplParams, CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($processorParams));

$sendTemplateParams = array(
$sendTemplateParams = [
'groupName' => $this->getSubscriptionDetails()->membership_id ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
'workflow' => $this->getSubscriptionDetails()->membership_id ? 'membership_autorenew_billing' : 'contribution_recurring_billing',
'contactId' => $this->getSubscriptionDetails()->contact_id,
Expand All @@ -331,7 +331,7 @@ public function postProcess() {
'from' => CRM_Contribute_BAO_ContributionRecur::getRecurFromAddress($this->getContributionRecurID()),
'toName' => $donorDisplayName,
'toEmail' => $donorEmail,
);
];
list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
}
else {
Expand Down
Loading