From e924d542d0e3779f4e0a98a36804481ba2b5485d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 26 Aug 2022 14:16:04 -0700 Subject: [PATCH] (NFC) CRM/Core - Autoformat `list()` statements --- CRM/Core/CommunityMessages.php | 2 +- CRM/Core/Controller.php | 6 +++--- CRM/Core/Controller/Simple.php | 2 +- CRM/Core/Form/Renderer.php | 2 +- CRM/Core/Form/Tag.php | 2 +- CRM/Core/Key.php | 2 +- CRM/Core/Menu.php | 2 +- CRM/Core/OptionValue.php | 4 ++-- CRM/Core/Page/File.php | 2 +- CRM/Core/PseudoConstant.php | 2 +- CRM/Core/QuickForm/Action/Display.php | 2 +- CRM/Core/Resources.php | 2 +- CRM/Core/Resources/Common.php | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CRM/Core/CommunityMessages.php b/CRM/Core/CommunityMessages.php index ebf881cdbe..0c054b351c 100644 --- a/CRM/Core/CommunityMessages.php +++ b/CRM/Core/CommunityMessages.php @@ -123,7 +123,7 @@ class CRM_Core_CommunityMessages { * parsed JSON */ public function fetchDocument() { - list($status, $json) = $this->client->get($this->getRenderedUrl()); + [$status, $json] = $this->client->get($this->getRenderedUrl()); if ($status != CRM_Utils_HttpClient::STATUS_OK || empty($json)) { return NULL; } diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 0d642d99f6..efad99f432 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -339,7 +339,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { // note that this is split into two, because some versions of // php 5.x core dump on the triple assignment :) $this->_actionName = $this->getActionName(); - list($pageName, $action) = $this->_actionName; + [$pageName, $action] = $this->_actionName; if ($this->isModal()) { if (!$this->isValid($pageName)) { @@ -360,7 +360,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { */ public function validate() { $this->_actionName = $this->getActionName(); - list($pageName, $action) = $this->_actionName; + [$pageName, $action] = $this->_actionName; $page = &$this->_pages[$pageName]; @@ -842,7 +842,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { */ public function cancelAction() { $actionName = $this->getActionName(); - list($pageName, $action) = $actionName; + [$pageName, $action] = $actionName; return $this->_pages[$pageName]->cancelAction(); } diff --git a/CRM/Core/Controller/Simple.php b/CRM/Core/Controller/Simple.php index f8739715f1..d88929e666 100644 --- a/CRM/Core/Controller/Simple.php +++ b/CRM/Core/Controller/Simple.php @@ -106,7 +106,7 @@ class CRM_Core_Controller_Simple extends CRM_Core_Controller { public function getTemplateFileName() { // there is only one form here, so should be quite easy $actionName = $this->getActionName(); - list($pageName, $action) = $actionName; + [$pageName, $action] = $actionName; return $this->_pages[$pageName]->getTemplateFileName(); } diff --git a/CRM/Core/Form/Renderer.php b/CRM/Core/Form/Renderer.php index 386c7e9130..e606b25b8c 100644 --- a/CRM/Core/Form/Renderer.php +++ b/CRM/Core/Form/Renderer.php @@ -109,7 +109,7 @@ class CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty { $this->renderFrozenDatepicker($el, $element); } elseif ($element->getAttribute('type') == 'text' && $element->getAttribute('formatType')) { - list($date, $time) = CRM_Utils_Date::setDateDefaults($element->getValue(), $element->getAttribute('formatType'), $element->getAttribute('format'), $element->getAttribute('timeformat')); + [$date, $time] = CRM_Utils_Date::setDateDefaults($element->getValue(), $element->getAttribute('formatType'), $element->getAttribute('format'), $element->getAttribute('timeformat')); $date .= ($element->getAttribute('timeformat')) ? " $time" : ''; $el['html'] = $date . ''; } diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index ba4c6cadbf..0d55661b3c 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -55,7 +55,7 @@ class CRM_Core_Form_Tag { $tagsetItem = $tagsetElementName . 'parentId_' . $parentId; $tagset[$tagsetItem]['parentID'] = $parentId; - list(, $mode) = explode('_', $entityTable); + [, $mode] = explode('_', $entityTable); if (!$tagsetElementName) { $tagsetElementName = $mode . "_taglist"; } diff --git a/CRM/Core/Key.php b/CRM/Core/Key.php index 40708b180a..f42b16c3ac 100644 --- a/CRM/Core/Key.php +++ b/CRM/Core/Key.php @@ -112,7 +112,7 @@ class CRM_Core_Key { } if ($addSequence) { - list($k, $t) = explode('_', $key); + [$k, $t] = explode('_', $key); if ($t < 1 || $t > 10000) { return NULL; } diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index c7376b2d34..d22073f07b 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -627,7 +627,7 @@ UNION ( $elements = explode(',', $pathArgs); foreach ($elements as $keyVal) { - list($key, $val) = explode('=', $keyVal, 2); + [$key, $val] = explode('=', $keyVal, 2); $arr[$key] = $val; } diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php index 89b566282d..803a69bfd2 100644 --- a/CRM/Core/OptionValue.php +++ b/CRM/Core/OptionValue.php @@ -338,7 +338,7 @@ class CRM_Core_OptionValue { if (is_array($nameTitle)) { foreach ($nameTitle as $name => $attribs) { self::$_fields[$key][$name] = $optionName; - list($tableName, $fieldName) = explode('.', $optionName['where']); + [$tableName, $fieldName] = explode('.', $optionName['where']); self::$_fields[$key][$name]['where'] = "{$name}.label"; foreach ($attribs as $k => $val) { self::$_fields[$key][$name][$k] = $val; @@ -362,7 +362,7 @@ class CRM_Core_OptionValue { if (!empty($values['pseudoconstant'])) { continue; } - list($tableName, $fieldName) = explode('.', $values['where']); + [$tableName, $fieldName] = explode('.', $values['where']); if (!empty($query->_returnProperties[$name])) { $query->_select["{$name}_id"] = "{$name}.value as {$name}_id"; $query->_element["{$name}_id"] = 1; diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index f92802d79e..8a660f727f 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -41,7 +41,7 @@ class CRM_Core_Page_File extends CRM_Core_Page { CRM_Core_Error::statusBounce(ts('URL for file is not valid')); } - list($path, $mimeType) = CRM_Core_BAO_File::path($fileId, $entityId); + [$path, $mimeType] = CRM_Core_BAO_File::path($fileId, $entityId); } else { if (!CRM_Utils_File::isValidFileName($fileName)) { diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index ca7189dc31..7f6e50531c 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -373,7 +373,7 @@ class CRM_Core_PseudoConstant { return NULL; } // We don't have good mapping so have to do a bit of guesswork from the menu - list(, $parent, , $child) = explode('_', $daoName); + [, $parent, , $child] = explode('_', $daoName); $sql = "SELECT path FROM civicrm_menu WHERE page_callback LIKE '%CRM_Admin_Page_$child%' OR page_callback LIKE '%CRM_{$parent}_Page_$child%' ORDER BY page_callback diff --git a/CRM/Core/QuickForm/Action/Display.php b/CRM/Core/QuickForm/Action/Display.php index ec32f64431..566399e6da 100644 --- a/CRM/Core/QuickForm/Action/Display.php +++ b/CRM/Core/QuickForm/Action/Display.php @@ -56,7 +56,7 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action { // If the original action was 'display' and we have values in container then we load them // BTW, if the page was invalid, we should later call validate() to get the errors - list(, $oldName) = $page->controller->getActionName(); + [, $oldName] = $page->controller->getActionName(); if ('display' == $oldName) { // If the controller is "modal" we should not allow direct access to a page // unless all previous pages are valid (see also bug #2323) diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index cc47859bc5..88a8d64a0e 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -449,7 +449,7 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface ) { return TRUE; } - list($arg0, $arg1) = array_pad(explode('/', (CRM_Utils_System::currentPath() ?? '')), 2, ''); + [$arg0, $arg1] = array_pad(explode('/', (CRM_Utils_System::currentPath() ?? '')), 2, ''); return ($arg0 === 'civicrm' && in_array($arg1, ['ajax', 'angularprofiles', 'asset'])); } diff --git a/CRM/Core/Resources/Common.php b/CRM/Core/Resources/Common.php index d62b096a91..d034b267fa 100644 --- a/CRM/Core/Resources/Common.php +++ b/CRM/Core/Resources/Common.php @@ -271,7 +271,7 @@ class CRM_Core_Resources_Common { // Add localized jQuery UI files if ($tsLocale && $tsLocale != 'en_US') { // Search for i18n file in order of specificity (try fr-CA, then fr) - list($lang) = explode('_', $tsLocale); + [$lang] = explode('_', $tsLocale); $path = "bower_components/jquery-ui/ui/i18n"; foreach ([str_replace('_', '-', $tsLocale), $lang] as $language) { $localizationFile = "$path/datepicker-{$language}.js"; -- 2.25.1