From 0d48f1cc2cefd21e794aa0c2750f328eebff80ba Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 5 Apr 2019 14:04:17 -0700 Subject: [PATCH] (NFC) Apply upcoming civicrm/coder policies (batch 1) Method: * Checkout latest merged branch of civicrm/coder (`8.x-2.x-civi`) * Run this command to autoclean a batch of 100 files `PG=1 SIZE=100 ; find Civi/ CRM/ api/ bin/ extern/ tests/ -name '*.php' | grep -v /examples/ | grep -v /DAO/ | sort | head -n $(( $PG * $SIZE )) | tail -n $SIZE | xargs phpcbf-civi` * Go through the diff. For anything that looks wonky, open in an editor and find a better solution Note: The automated checker makes good points about awkward indentation, but the automated cleanup often makes it worse. So that's why I have to open it up. --- CRM/ACL/Form/ACL.php | 30 +++++++++++------------ CRM/ACL/Form/ACLBasic.php | 6 ++--- CRM/ACL/Page/ACL.php | 24 +++++++++---------- CRM/Activity/ActionMapping.php | 1 - CRM/Activity/BAO/Activity.php | 8 +++---- CRM/Activity/Form/Activity.php | 6 +---- CRM/Activity/Form/ActivityView.php | 2 +- CRM/Activity/Form/Task/FileOnCase.php | 3 ++- CRM/Activity/Import/Form/MapField.php | 2 +- CRM/Activity/Import/Parser.php | 18 +++++--------- CRM/Activity/Tokens.php | 3 ++- CRM/Admin/Form.php | 34 +++++++++++++-------------- CRM/Admin/Form/CMSUser.php | 21 ++++++++--------- CRM/Admin/Form/Extensions.php | 21 ++++++++--------- CRM/Admin/Form/Generic.php | 21 ++++++++--------- CRM/Admin/Form/Job.php | 6 ++--- CRM/Admin/Form/Mapping.php | 6 ++--- CRM/Admin/Form/MessageTemplates.php | 15 ++++++------ CRM/Admin/Form/Options.php | 33 ++++++++++---------------- CRM/Admin/Form/PaymentProcessor.php | 10 ++++---- CRM/Admin/Form/PdfFormats.php | 6 ++--- CRM/Admin/Form/Persistent.php | 21 ++++++++--------- CRM/Admin/Form/Preferences.php | 21 ++++++++--------- CRM/Admin/Form/RelationshipType.php | 4 ++-- CRM/Admin/Form/Setting.php | 24 +++++++++---------- CRM/Admin/Form/Setting/UF.php | 3 ++- CRM/Admin/Form/WordReplacements.php | 21 ++++++++--------- CRM/Admin/Page/AJAX.php | 4 ++-- 28 files changed, 174 insertions(+), 200 deletions(-) diff --git a/CRM/ACL/Form/ACL.php b/CRM/ACL/Form/ACL.php index 76e5426562..b119f7503a 100644 --- a/CRM/ACL/Form/ACL.php +++ b/CRM/ACL/Form/ACL.php @@ -141,30 +141,30 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form { $label = ts('Role'); $role = [ - '-1' => ts('- select role -'), - '0' => ts('Everyone'), - ] + CRM_Core_OptionGroup::values('acl_role'); + '-1' => ts('- select role -'), + '0' => ts('Everyone'), + ] + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'entity_id', $label, $role, TRUE); $group = [ - '-1' => ts('- select -'), - '0' => ts('All Groups'), - ] + CRM_Core_PseudoConstant::group(); + '-1' => ts('- select -'), + '0' => ts('All Groups'), + ] + CRM_Core_PseudoConstant::group(); $customGroup = [ - '-1' => ts('- select -'), - '0' => ts('All Custom Groups'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Custom Groups'), + ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); $ufGroup = [ - '-1' => ts('- select -'), - '0' => ts('All Profiles'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Profiles'), + ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); $event = [ - '-1' => ts('- select -'), - '0' => ts('All Events'), - ] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); + '-1' => ts('- select -'), + '0' => ts('All Events'), + ] + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )"); $this->add('select', 'group_id', ts('Group'), $group); $this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup); diff --git a/CRM/ACL/Form/ACLBasic.php b/CRM/ACL/Form/ACLBasic.php index af902384fd..263b495927 100644 --- a/CRM/ACL/Form/ACLBasic.php +++ b/CRM/ACL/Form/ACLBasic.php @@ -80,9 +80,9 @@ SELECT object_table $label = ts('Role'); $role = [ - '-1' => ts('- select role -'), - '0' => ts('Everyone'), - ] + CRM_Core_OptionGroup::values('acl_role'); + '-1' => ts('- select role -'), + '0' => ts('Everyone'), + ] + CRM_Core_OptionGroup::values('acl_role'); $entityID = &$this->add('select', 'entity_id', $label, $role, TRUE); if ($this->_id) { diff --git a/CRM/ACL/Page/ACL.php b/CRM/ACL/Page/ACL.php index f056c675ce..4413ce82b2 100644 --- a/CRM/ACL/Page/ACL.php +++ b/CRM/ACL/Page/ACL.php @@ -123,22 +123,22 @@ ORDER BY entity_id $roles = CRM_Core_OptionGroup::values('acl_role'); $group = [ - '-1' => ts('- select -'), - '0' => ts('All Groups'), - ] + CRM_Core_PseudoConstant::group(); + '-1' => ts('- select -'), + '0' => ts('All Groups'), + ] + CRM_Core_PseudoConstant::group(); $customGroup = [ - '-1' => ts('- select -'), - '0' => ts('All Custom Groups'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Custom Groups'), + ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id'); $ufGroup = [ - '-1' => ts('- select -'), - '0' => ts('All Profiles'), - ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + '-1' => ts('- select -'), + '0' => ts('All Profiles'), + ] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); $event = [ - '-1' => ts('- select -'), - '0' => ts('All Events'), - ] + CRM_Event_PseudoConstant::event(); + '-1' => ts('- select -'), + '0' => ts('All Events'), + ] + CRM_Event_PseudoConstant::event(); while ($dao->fetch()) { $acl[$dao->id] = []; diff --git a/CRM/Activity/ActionMapping.php b/CRM/Activity/ActionMapping.php index 9f5dccb1f6..5251972ea9 100644 --- a/CRM/Activity/ActionMapping.php +++ b/CRM/Activity/ActionMapping.php @@ -30,7 +30,6 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ -use Civi\ActionSchedule\RecipientBuilder; /** * Class CRM_Activity_ActionMapping diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index dc66751ca4..e454ef229e 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -1207,7 +1207,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } if (!isset($contactDetails) && !isset($contactIds)) { - Throw new CRM_Core_Exception('You must specify either $contactDetails or $contactIds'); + throw new CRM_Core_Exception('You must specify either $contactDetails or $contactIds'); } // Populate $contactDetails and $contactIds if only one is set if (is_array($contactIds) && !empty($contactIds) && empty($contactDetails)) { @@ -2403,9 +2403,9 @@ INNER JOIN civicrm_option_group grp ON (grp.id = option_group_id AND grp.name = $enabledComponents = self::activityComponents(); // @todo - should we move this to activity get api. foreach ([ - 'case_id' => 'CiviCase', - 'campaign_id' => 'CiviCampaign', - ] as $attr => $component) { + 'case_id' => 'CiviCase', + 'campaign_id' => 'CiviCampaign', + ] as $attr => $component) { if (!in_array($component, $enabledComponents)) { $activityParams[$attr] = ['IS NULL' => 1]; } diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index b3e65e0c87..7fffdb7cd5 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -260,11 +260,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { if (CRM_Contact_Form_Search::isSearchContext($this->_context)) { $this->_context = 'search'; } - elseif (!in_array($this->_context, [ - 'dashlet', - 'case', - 'dashletFullscreen', - ]) + elseif (!in_array($this->_context, ['dashlet', 'case', 'dashletFullscreen']) && $this->_currentlyViewedContactId ) { $this->_context = 'activity'; diff --git a/CRM/Activity/Form/ActivityView.php b/CRM/Activity/Form/ActivityView.php index 4a2ef88b30..d0e8843971 100644 --- a/CRM/Activity/Form/ActivityView.php +++ b/CRM/Activity/Form/ActivityView.php @@ -130,7 +130,7 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form { 'spacing' => '         ', 'isDefault' => TRUE, ], - ] + ] ); } diff --git a/CRM/Activity/Form/Task/FileOnCase.php b/CRM/Activity/Form/Task/FileOnCase.php index 90225b18a6..893012b15c 100644 --- a/CRM/Activity/Form/Task/FileOnCase.php +++ b/CRM/Activity/Form/Task/FileOnCase.php @@ -109,7 +109,8 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task { } } else { - CRM_Core_Session::setStatus(ts('Not permitted to file activity %1 %2.', [ + CRM_Core_Session::setStatus( + ts('Not permitted to file activity %1 %2.', [ 1 => empty($defaults['subject']) ? '' : $defaults['subject'], 2 => $defaults['activity_date_time'], ]), diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 9cbb7d7e27..f2f59dc04f 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -251,7 +251,7 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField { 'type' => 'cancel', 'name' => ts('Cancel'), ], - ] + ] ); } diff --git a/CRM/Activity/Import/Parser.php b/CRM/Activity/Import/Parser.php index 664e4a0deb..aca1639857 100644 --- a/CRM/Activity/Import/Parser.php +++ b/CRM/Activity/Import/Parser.php @@ -240,30 +240,24 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { } if ($this->_invalidRowCount) { // removed view url for invlaid contacts - $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], + $headers = array_merge( + [ts('Line Number'), ts('Reason')], $customHeaders ); $this->_errorFileName = self::errorFileName(self::ERROR); self::exportCSV($this->_errorFileName, $headers, $this->_errors); } if ($this->_conflictCount) { - $headers = array_merge([ - ts('Line Number'), - ts('Reason'), - ], + $headers = array_merge( + [ts('Line Number'), ts('Reason')], $customHeaders ); $this->_conflictFileName = self::errorFileName(self::CONFLICT); self::exportCSV($this->_conflictFileName, $headers, $this->_conflicts); } if ($this->_duplicateCount) { - $headers = array_merge([ - ts('Line Number'), - ts('View Activity History URL'), - ], + $headers = array_merge( + [ts('Line Number'), ts('View Activity History URL')], $customHeaders ); diff --git a/CRM/Activity/Tokens.php b/CRM/Activity/Tokens.php index 4bd22e2dd9..ebb83d02f1 100644 --- a/CRM/Activity/Tokens.php +++ b/CRM/Activity/Tokens.php @@ -78,7 +78,8 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber { // Q: Could we simplify & move the extra AND clauses into `where(...)`? $e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0'); - $e->query->select('e.*'); // FIXME: seems too broad. + // FIXME: seems too broad. + $e->query->select('e.*'); $e->query->select('ov.label as activity_type, e.id as activity_id'); $e->query->join("og", "!casMailingJoinType civicrm_option_group og ON og.name = 'activity_type'"); diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index eae8333691..e4edfb0a7c 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -128,27 +128,25 @@ class CRM_Admin_Form extends CRM_Core_Form { public function buildQuickForm() { if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) { $this->addButtons([ - [ - 'type' => 'cancel', - 'name' => ts('Done'), - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'cancel', + 'name' => ts('Done'), + 'isDefault' => TRUE, + ], + ]); } else { $this->addButtons([ - [ - 'type' => 'next', - 'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } } diff --git a/CRM/Admin/Form/CMSUser.php b/CRM/Admin/Form/CMSUser.php index 37ce38eb8d..44305056b6 100644 --- a/CRM/Admin/Form/CMSUser.php +++ b/CRM/Admin/Form/CMSUser.php @@ -42,17 +42,16 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form { public function buildQuickForm() { $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('OK'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('OK'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** diff --git a/CRM/Admin/Form/Extensions.php b/CRM/Admin/Form/Extensions.php index 35927326e9..852ebb0820 100644 --- a/CRM/Admin/Form/Extensions.php +++ b/CRM/Admin/Form/Extensions.php @@ -137,17 +137,16 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { $this->assign('title', $title); $this->addButtons([ - [ - 'type' => 'next', - 'name' => $buttonName, - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => $buttonName, + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** diff --git a/CRM/Admin/Form/Generic.php b/CRM/Admin/Form/Generic.php index 9919469cba..04b29ecd97 100644 --- a/CRM/Admin/Form/Generic.php +++ b/CRM/Admin/Form/Generic.php @@ -84,17 +84,16 @@ class CRM_Admin_Form_Generic extends CRM_Core_Form { // @todo - do we still like this redirect? CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } /** diff --git a/CRM/Admin/Form/Job.php b/CRM/Admin/Form/Job.php index 624e03a70e..42f4a3c386 100644 --- a/CRM/Admin/Form/Job.php +++ b/CRM/Admin/Form/Job.php @@ -78,9 +78,9 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form { ); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ - 'CRM_Core_DAO_Job', - $this->_id, - ]); + 'CRM_Core_DAO_Job', + $this->_id, + ]); $this->add('text', 'description', ts('Description'), $attributes['description'] diff --git a/CRM/Admin/Form/Mapping.php b/CRM/Admin/Form/Mapping.php index 8dc369ae95..2dac50e763 100644 --- a/CRM/Admin/Form/Mapping.php +++ b/CRM/Admin/Form/Mapping.php @@ -61,9 +61,9 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form { CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'name'), TRUE ); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ - 'CRM_Core_DAO_Mapping', - $this->_id, - ]); + 'CRM_Core_DAO_Mapping', + $this->_id, + ]); $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description') diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index b3dab48731..8ff7528fda 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -95,14 +95,13 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'); $cancelURL = str_replace('&', '&', $cancelURL); $this->addButtons([ - [ - 'type' => 'cancel', - 'name' => ts('Done'), - 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"], - 'isDefault' => TRUE, - ], - ] - ); + [ + 'type' => 'cancel', + 'name' => ts('Done'), + 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"], + 'isDefault' => TRUE, + ], + ]); } else { $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values); diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index b380feacf5..3e8dd6a65a 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -96,9 +96,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { if ($isInUse) { $scriptURL = "" . ts('Learn more about a script that can automatically update contact addressee and greeting options.') . ""; CRM_Core_Session::setStatus(ts('The selected %1 option has not been deleted because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', [ - 1 => $this->_gLabel, - 2 => $scriptURL, - ]), ts('Sorry'), 'error'); + 1 => $this->_gLabel, + 2 => $scriptURL, + ]), ts('Sorry'), 'error'); $redirect = CRM_Utils_System::url($url, $params); CRM_Utils_System::redirect($redirect); } @@ -193,11 +193,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { $this->add('color', 'color', ts('Color')); } - if (!in_array($this->_gName, [ - 'email_greeting', - 'postal_greeting', - 'addressee', - ]) && !$isReserved + if (!in_array($this->_gName, ['email_greeting', 'postal_greeting', 'addressee']) + && !$isReserved ) { $this->addRule('label', ts('This Label already exists in the database for this option group. Please select a different Label.'), @@ -323,11 +320,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { } // get contact type for which user want to create a new greeting/addressee type, CRM-4575 - if (in_array($this->_gName, [ - 'email_greeting', - 'postal_greeting', - 'addressee', - ]) && !$isReserved + if (in_array($this->_gName, ['email_greeting', 'postal_greeting', 'addressee']) + && !$isReserved ) { $values = [ 1 => ts('Individual'), @@ -372,11 +366,8 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { $errors['grouping'] = ts('Status class is a required field'); } - if (in_array($self->_gName, [ - 'email_greeting', - 'postal_greeting', - 'addressee', - ]) && empty($self->_defaultValues['is_reserved']) + if (in_array($self->_gName, ['email_greeting', 'postal_greeting', 'addressee']) + && empty($self->_defaultValues['is_reserved']) ) { $label = $fields['label']; $condition = " AND v.label = '{$label}' "; @@ -487,9 +478,9 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { $optionValue = CRM_Core_OptionValue::addOptionValue($params, $this->_gName, $this->_action, $this->_id); CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', [ - 1 => $this->_gLabel, - 2 => $optionValue->label, - ]), ts('Saved'), 'success'); + 1 => $this->_gLabel, + 2 => $optionValue->label, + ]), ts('Saved'), 'success'); $this->ajaxResponse['optionValue'] = $optionValue->toArray(); } diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 84fdf07e7d..aef46cc304 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -183,11 +183,11 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { ); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ - 'CRM_Financial_DAO_PaymentProcessor', - $this->_id, - 'name', - CRM_Core_Config::domainID(), - ]); + 'CRM_Financial_DAO_PaymentProcessor', + $this->_id, + 'name', + CRM_Core_Config::domainID(), + ]); $this->add('text', 'description', ts('Description'), $attributes['description'] diff --git a/CRM/Admin/Form/PdfFormats.php b/CRM/Admin/Form/PdfFormats.php index c075b044bb..94e29cbf03 100644 --- a/CRM/Admin/Form/PdfFormats.php +++ b/CRM/Admin/Form/PdfFormats.php @@ -80,9 +80,9 @@ class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form { $this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE); $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [ - 'CRM_Core_BAO_PdfFormat', - $this->_id, - ]); + 'CRM_Core_BAO_PdfFormat', + $this->_id, + ]); $this->addRule('margin_left', ts('Margin must be numeric'), 'numeric'); $this->addRule('margin_right', ts('Margin must be numeric'), 'numeric'); $this->addRule('margin_top', ts('Margin must be numeric'), 'numeric'); diff --git a/CRM/Admin/Form/Persistent.php b/CRM/Admin/Form/Persistent.php index 3c44d84737..e62d3313bc 100644 --- a/CRM/Admin/Form/Persistent.php +++ b/CRM/Admin/Form/Persistent.php @@ -73,17 +73,16 @@ class CRM_Admin_Form_Persistent extends CRM_Core_Form { $this->add('text', 'name', ts('Name:'), NULL, TRUE); $this->add('textarea', 'data', ts('Data:'), ['rows' => 4, 'cols' => 50], TRUE); $this->addButtons([ - [ - 'type' => 'submit', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'submit', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); } public function postProcess() { diff --git a/CRM/Admin/Form/Preferences.php b/CRM/Admin/Form/Preferences.php index 6a6e8e2e7a..55578d404a 100644 --- a/CRM/Admin/Form/Preferences.php +++ b/CRM/Admin/Form/Preferences.php @@ -228,17 +228,16 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form { } $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); if ($this->_action == CRM_Core_Action::VIEW) { $this->freeze(); diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php index 8383ed28de..1b537f9063 100644 --- a/CRM/Admin/Form/RelationshipType.php +++ b/CRM/Admin/Form/RelationshipType.php @@ -69,11 +69,11 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form { ], 'label_b_a' => [ 'name' => 'label_b_a', - 'description' => ts("Label for the relationship from Contact B to Contact A. EXAMPLE: Contact B is 'Child of' Contact A. You may leave this blank for relationships where the name is the same in both directions (e.g. Spouse).") + 'description' => ts("Label for the relationship from Contact B to Contact A. EXAMPLE: Contact B is 'Child of' Contact A. You may leave this blank for relationships where the name is the same in both directions (e.g. Spouse)."), ], 'description' => [ 'name' => 'description', - 'description' => '' + 'description' => '', ], 'contact_types_a' => ['name' => 'contact_types_a', 'not-auto-addable' => TRUE], 'contact_types_b' => ['name' => 'contact_types_b', 'not-auto-addable' => TRUE], diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 6f60a4c933..e0be4241a3 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -74,17 +74,16 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { public function buildQuickForm() { CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $this->addFieldsDefinedInSettingsMetadata(); @@ -143,7 +142,8 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } CRM_Core_Config::clearDBCache(); - Civi::cache('session')->clear(); // This doesn't make a lot of sense to me, but it maintains pre-existing behavior. + // This doesn't make a lot of sense to me, but it maintains pre-existing behavior. + Civi::cache('session')->clear(); CRM_Utils_System::flushCache(); CRM_Core_Resources::singleton()->resetCacheCode(); diff --git a/CRM/Admin/Form/Setting/UF.php b/CRM/Admin/Form/Setting/UF.php index 7fa620428d..efb8e9a44f 100644 --- a/CRM/Admin/Form/Setting/UF.php +++ b/CRM/Admin/Form/Setting/UF.php @@ -85,7 +85,8 @@ class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting { if ($config->userFramework === 'Backdrop') { $tablePrefixes = '$database_prefix = array('; } - $tablePrefixes .= "\n 'default' => '$drupal_prefix',"; // add default prefix: the drupal database prefix + // add default prefix: the drupal database prefix + $tablePrefixes .= "\n 'default' => '$drupal_prefix',"; $prefix = ""; if ($config->dsn != $config->userFrameworkDSN) { $prefix = "`{$dsnArray['database']}`."; diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php index df67f04a24..7213107cf5 100644 --- a/CRM/Admin/Form/WordReplacements.php +++ b/CRM/Admin/Form/WordReplacements.php @@ -139,17 +139,16 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form { $this->assign('stringOverrideInstances', empty($stringOverrideInstances) ? FALSE : $stringOverrideInstances); $this->addButtons([ - [ - 'type' => 'next', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ], - [ - 'type' => 'cancel', - 'name' => ts('Cancel'), - ], - ] - ); + [ + 'type' => 'next', + 'name' => ts('Save'), + 'isDefault' => TRUE, + ], + [ + 'type' => 'cancel', + 'name' => ts('Cancel'), + ], + ]); $this->addFormRule(['CRM_Admin_Form_WordReplacements', 'formRule'], $this); } diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 02a9485e3b..f6dc2edee1 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -162,8 +162,8 @@ class CRM_Admin_Page_AJAX { $ret['illegal'] = TRUE; $table = $template->fetch('CRM/Price/Page/table.tpl'); $ret['content'] = ts('Unable to disable the \'%1\' price set - it is currently in use by one or more active events, contribution pages or contributions.', [ - 1 => $priceSet, - ]) . "
$table"; + 1 => $priceSet, + ]) . "
$table"; } else { $ret['content'] = ts('Are you sure you want to disable \'%1\' Price Set?', [1 => $priceSet]); -- 2.25.1