diff --git a/administrator/components/com_categories/src/Model/CategoriesModel.php b/administrator/components/com_categories/src/Model/CategoriesModel.php index 8eb7b2ab901e..271a585f0628 100644 --- a/administrator/components/com_categories/src/Model/CategoriesModel.php +++ b/administrator/components/com_categories/src/Model/CategoriesModel.php @@ -249,8 +249,8 @@ protected function getListQuery() $categoryId = $categoryId ? [$categoryId] : []; } - // Case: Using both categories filter and by level filter if (\count($categoryId)) { + // Case: Using both categories filter and by level filter $categoryTable = Table::getInstance('Category', 'JTable'); $subCatItemsWhere = []; @@ -264,8 +264,8 @@ protected function getListQuery() $query->where('(' . implode(' OR ', $subCatItemsWhere) . ')'); - // Case: Using only the by level filter } elseif ($level) { + // Case: Using only the by level filter $query->where($db->quoteName('a.level') . ' <= :level') ->bind(':level', $level, ParameterType::INTEGER); } diff --git a/administrator/components/com_finder/src/Indexer/Adapter.php b/administrator/components/com_finder/src/Indexer/Adapter.php index 4bc1d54a41ca..f398751b16d3 100644 --- a/administrator/components/com_finder/src/Indexer/Adapter.php +++ b/administrator/components/com_finder/src/Indexer/Adapter.php @@ -922,20 +922,20 @@ protected function translateState($item, $category = null) // Translate the state switch ($item) { - // Published items should always show up in search results case 1: + // Published items should always show up in search results return 1; - // Archived items should only show up when option is enabled case 2: + // Archived items should only show up when option is enabled if ($this->params->get('search_archived', 1) == 0) { return 0; } return 1; - // All other states should return an unpublished state default: + // All other states should return an unpublished state return 0; } } diff --git a/administrator/components/com_finder/src/Indexer/DebugAdapter.php b/administrator/components/com_finder/src/Indexer/DebugAdapter.php index 98d2d52c0335..b389c897aa04 100644 --- a/administrator/components/com_finder/src/Indexer/DebugAdapter.php +++ b/administrator/components/com_finder/src/Indexer/DebugAdapter.php @@ -920,13 +920,13 @@ protected function translateState($item, $category = null) // Translate the state switch ($item) { - // Published and archived items only should return a published state case 1: case 2: + // Published and archived items only should return a published state return 1; - // All other states should return an unpublished state default: + // All other states should return an unpublished state return 0; } } diff --git a/administrator/components/com_finder/src/Indexer/Query.php b/administrator/components/com_finder/src/Indexer/Query.php index ea893430082a..7a92521c3a1a 100644 --- a/administrator/components/com_finder/src/Indexer/Query.php +++ b/administrator/components/com_finder/src/Indexer/Query.php @@ -794,9 +794,9 @@ protected function processString($input, $lang, $mode) // Now we have to handle the filter string. switch ($modifier) { - // Handle a before and after date filters. case 'before': case 'after': + // Handle a before and after date filters. // Get the time offset. $offset = Factory::getApplication()->get('offset'); @@ -820,8 +820,8 @@ protected function processString($input, $lang, $mode) break; - // Handle a taxonomy branch filter. default: + // Handle a taxonomy branch filter. // Try to find the node id. $return = Taxonomy::getNodeByTitle($modifier, $value); diff --git a/administrator/components/com_installer/src/Model/UpdateModel.php b/administrator/components/com_installer/src/Model/UpdateModel.php index 81d27386d15e..21555b68ce57 100644 --- a/administrator/components/com_installer/src/Model/UpdateModel.php +++ b/administrator/components/com_installer/src/Model/UpdateModel.php @@ -552,8 +552,8 @@ protected function loadFormData() protected function preparePreUpdate($update, $table) { switch ($table->type) { - // Components could have a helper which adds additional data case 'component': + // Components could have a helper which adds additional data $ename = str_replace('com_', '', $table->element); $fname = $ename . '.php'; $cname = ucfirst($ename) . 'Helper'; @@ -570,8 +570,8 @@ protected function preparePreUpdate($update, $table) break; - // Modules could have a helper which adds additional data case 'module': + // Modules could have a helper which adds additional data $cname = str_replace('_', '', $table->element) . 'Helper'; $path = ($table->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $table->element . '/helper.php'; @@ -585,9 +585,9 @@ protected function preparePreUpdate($update, $table) break; + case 'plugin': // If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload" // But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin - case 'plugin': $cname = str_replace('plg_', '', $table->element); PluginHelper::importPlugin($table->folder, $cname); break; diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php index c0da77051db7..b77ef7e49854 100644 --- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php +++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php @@ -88,19 +88,19 @@ public function applyUpdateSite() $params = ComponentHelper::getParams('com_joomlaupdate'); switch ($params->get('updatesource', 'nochange')) { - // "Minor & Patch Release for Current version AND Next Major Release". case 'next': + // "Minor & Patch Release for Current version AND Next Major Release". $updateURL = 'https://update.joomla.org/core/sts/list_sts.xml'; break; - // "Testing" case 'testing': + // "Testing" $updateURL = 'https://update.joomla.org/core/test/list_test.xml'; break; + case 'custom': // "Custom" // @todo: check if the customurl is valid and not just "not empty". - case 'custom': if (trim($params->get('customurl', '')) != '') { $updateURL = trim($params->get('customurl', '')); } else { @@ -110,6 +110,7 @@ public function applyUpdateSite() } break; + default: /** * "Minor & Patch Release for Current version (recommended and default)". * The commented "case" below are for documenting where 'default' and legacy options falls @@ -118,7 +119,6 @@ public function applyUpdateSite() * case 'sts': (It's shown as "Default" because that option does not exist any more) * case 'nochange': */ - default: $updateURL = 'https://update.joomla.org/core/list.xml'; } diff --git a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php index 649e00c56c39..5147b60e20b6 100644 --- a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php +++ b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php @@ -233,24 +233,25 @@ public function display($tpl = null) $params = ComponentHelper::getParams('com_joomlaupdate'); switch ($params->get('updatesource', 'default')) { - // "Minor & Patch Release for Current version AND Next Major Release". case 'next': + // "Minor & Patch Release for Current version AND Next Major Release". $this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT'; $this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'); break; - // "Testing" case 'testing': + // "Testing" $this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING'; $this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING'); break; - // "Custom" case 'custom': + // "Custom" $this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM'; $this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM'); break; + default: /** * "Minor & Patch Release for Current version (recommended and default)". * The commented "case" below are for documenting where 'default' and legacy options falls @@ -259,7 +260,6 @@ public function display($tpl = null) * case 'lts': * case 'nochange': */ - default: $this->langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT'; $this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT'); } diff --git a/administrator/components/com_media/src/Controller/PluginController.php b/administrator/components/com_media/src/Controller/PluginController.php index 9e34023998ce..b97b636fdeb7 100644 --- a/administrator/components/com_media/src/Controller/PluginController.php +++ b/administrator/components/com_media/src/Controller/PluginController.php @@ -94,16 +94,16 @@ public function oauthcallback() * - control-panel : Redirect to Control Panel */ switch ($action) { - /** - * Close a window opened by developer - * Use this for close New Windows opened for OAuth Process - */ case 'close': + /** + * Close a window opened by developer + * Use this for close New Windows opened for OAuth Process + */ $this->setRedirect(Route::_('index.php?option=com_media&view=plugin&action=close', false)); break; - // Redirect browser to any page specified by the user case 'redirect': + // Redirect browser to any page specified by the user if (!isset($eventResults['redirect_uri'])) { throw new \Exception("Redirect URI must be set in the plugin"); } @@ -111,14 +111,14 @@ public function oauthcallback() $this->setRedirect($eventResults['redirect_uri']); break; - // Redirect browser to Control Panel case 'control-panel': + // Redirect browser to Control Panel $this->setRedirect(Route::_('index.php', false)); break; - // Redirect browser to Media Manager case 'media-manager': default: + // Redirect browser to Media Manager $this->setRedirect(Route::_('index.php?option=com_media&view=media', false)); } } catch (\Exception $e) { diff --git a/administrator/components/com_privacy/src/Controller/RequestController.php b/administrator/components/com_privacy/src/Controller/RequestController.php index d3159979ef46..846ebf68862b 100644 --- a/administrator/components/com_privacy/src/Controller/RequestController.php +++ b/administrator/components/com_privacy/src/Controller/RequestController.php @@ -393,10 +393,10 @@ private function canTransition($item, $newStatus) // A confirmed item can be marked completed or invalid return \in_array($newStatus, ['-1', '2'], true); - // An item which is already in an invalid or complete state cannot transition, likewise if we don't know the state don't change anything case '-1': case '2': default: + // An item which is already in an invalid or complete state cannot transition, likewise if we don't know the state don't change anything return false; } } diff --git a/administrator/components/com_privacy/src/View/Request/HtmlView.php b/administrator/components/com_privacy/src/View/Request/HtmlView.php index 01f695cbdf6e..bfd1772ccce3 100644 --- a/administrator/components/com_privacy/src/View/Request/HtmlView.php +++ b/administrator/components/com_privacy/src/View/Request/HtmlView.php @@ -173,8 +173,8 @@ protected function addToolbar() break; - // Item is in a "locked" state and cannot transition default: + // Item is in a "locked" state and cannot transition break; } diff --git a/administrator/components/com_users/src/Controller/DisplayController.php b/administrator/components/com_users/src/Controller/DisplayController.php index a6a64d81cc81..3530077485a9 100644 --- a/administrator/components/com_users/src/Controller/DisplayController.php +++ b/administrator/components/com_users/src/Controller/DisplayController.php @@ -49,15 +49,15 @@ protected function canView($view) $canDo = ContentHelper::getActions('com_users'); switch ($view) { - // Special permissions. case 'groups': case 'group': case 'levels': case 'level': + // Special permissions. return $canDo->get('core.admin'); - // Default permissions. default: + // Default permissions. return true; } } diff --git a/administrator/components/com_users/src/Model/UserModel.php b/administrator/components/com_users/src/Model/UserModel.php index 68fcd957be82..cdbbd8ed9bae 100644 --- a/administrator/components/com_users/src/Model/UserModel.php +++ b/administrator/components/com_users/src/Model/UserModel.php @@ -703,20 +703,20 @@ public function batchUser($groupId, $userIds, $action) $db = $this->getDatabase(); switch ($action) { - // Sets users to a selected group case 'set': + // Sets users to a selected group $doDelete = 'all'; $doAssign = true; break; - // Remove users from a selected group case 'del': + // Remove users from a selected group $doDelete = 'group'; break; - // Add users to a selected group case 'add': default: + // Add users to a selected group $doAssign = true; break; } diff --git a/build/build.php b/build/build.php index 2534fed22016..a265e7ce22ed 100644 --- a/build/build.php +++ b/build/build.php @@ -512,14 +512,14 @@ function clean_composer(string $dir) break; - // Deleted files case 'D': + // Deleted files $deletedFiles[] = $fileName; break; - // Regular additions and modifications default: + // Regular additions and modifications $filesArray[$fileName] = true; break; diff --git a/components/com_ajax/ajax.php b/components/com_ajax/ajax.php index 62c00f42e81e..4c06d66bf8cf 100644 --- a/components/com_ajax/ajax.php +++ b/components/com_ajax/ajax.php @@ -204,14 +204,14 @@ // Return the results in the desired format switch ($format) { - // JSONinzed case 'json': + // JSONinzed echo new JsonResponse($results, null, false, $input->get('ignoreMessages', true, 'bool')); break; - // Handle as raw format default: + // Handle as raw format // Output exception if ($results instanceof Exception) { // Log an error diff --git a/components/com_users/src/Controller/DisplayController.php b/components/com_users/src/Controller/DisplayController.php index 89a9c713cf3a..6cf720999980 100644 --- a/components/com_users/src/Controller/DisplayController.php +++ b/components/com_users/src/Controller/DisplayController.php @@ -73,8 +73,8 @@ public function display($cachable = false, $urlparams = false) $model = $this->getModel('Registration'); break; - // Handle view specific models. case 'profile': + // Handle view specific models. // If the user is a guest, redirect to the login page. $user = $this->app->getIdentity(); @@ -88,8 +88,8 @@ public function display($cachable = false, $urlparams = false) $model = $this->getModel($vName); break; - // Handle the default views. case 'login': + // Handle the default views. $model = $this->getModel($vName); break; diff --git a/libraries/src/Filesystem/Stream.php b/libraries/src/Filesystem/Stream.php index bbbbfa942fe0..a0d57fe1c385 100644 --- a/libraries/src/Filesystem/Stream.php +++ b/libraries/src/Filesystem/Stream.php @@ -259,19 +259,19 @@ public function open( // Decide which context to use: switch ($this->processingmethod) { - // Gzip doesn't support contexts or streams case 'gz': + // Gzip doesn't support contexts or streams $this->fh = gzopen($filename, $mode, $useIncludePath); break; - // Bzip2 is much like gzip except it doesn't use the include path case 'bz': + // Bzip2 is much like gzip except it doesn't use the include path $this->fh = bzopen($filename, $mode); break; - // Fopen can handle streams case 'f': default: + // Fopen can handle streams // One supplied at open; overrides everything if ($context) { $this->fh = fopen($filename, $mode, $useIncludePath, $context); diff --git a/libraries/src/Form/Field/CalendarField.php b/libraries/src/Form/Field/CalendarField.php index 489f79178596..bea6338dbfc7 100644 --- a/libraries/src/Form/Field/CalendarField.php +++ b/libraries/src/Form/Field/CalendarField.php @@ -415,8 +415,8 @@ public function filter($value, $group = null, Registry $input = null) $return = Factory::getDate($value, $app->get('offset'))->toSql(); break; - // Convert a date to UTC based on the user timezone offset. case 'USER_UTC': + // Convert a date to UTC based on the user timezone offset. // Get the user timezone setting defaulting to the server timezone setting. $offset = $app->getIdentity()->getParam('timezone', $app->get('offset')); diff --git a/libraries/src/Form/Field/GroupedlistField.php b/libraries/src/Form/Field/GroupedlistField.php index 89eff495843d..1cbaf445be63 100644 --- a/libraries/src/Form/Field/GroupedlistField.php +++ b/libraries/src/Form/Field/GroupedlistField.php @@ -56,8 +56,8 @@ protected function getGroups() foreach ($this->element->children() as $element) { switch ($element->getName()) { - // The element is an