diff --git a/Build/.php_cs b/Build/.php_cs index dc5933d52125da352226f061da4ec134cc9904bf..3c75657f91e2d98f5c0c02b4ceae42dbeeb6af02 100644 --- a/Build/.php_cs +++ b/Build/.php_cs @@ -78,6 +78,8 @@ return PhpCsFixer\Config::create() 'no_short_bool_cast' => true, 'no_unneeded_control_parentheses' => true, 'phpdoc_no_empty_return' => true, - 'phpdoc_trim' => true + 'phpdoc_trim' => true, + 'no_superfluous_elseif' => true, + 'no_useless_else' => true, ]) ->setFinder($finder); diff --git a/composer.lock b/composer.lock index 2644475160764072dae5947e703f3377afafd2f5..93bfa6968528b0b540f802010fb0608031f5da7c 100644 --- a/composer.lock +++ b/composer.lock @@ -1779,16 +1779,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.4.1", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "b4983586c8e7b1f99ec05dd1e75c8b673315da70" + "reference": "63aad575ec2a29d50eb6c3b5cbc17430b28895b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/b4983586c8e7b1f99ec05dd1e75c8b673315da70", - "reference": "b4983586c8e7b1f99ec05dd1e75c8b673315da70", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/63aad575ec2a29d50eb6c3b5cbc17430b28895b2", + "reference": "63aad575ec2a29d50eb6c3b5cbc17430b28895b2", "shasum": "" }, "require": { @@ -1798,7 +1798,7 @@ "gecko-packages/gecko-php-unit": "^2.0", "php": "^5.6 || >=7.0 <7.2", "sebastian/diff": "^1.4", - "symfony/console": "^3.0", + "symfony/console": "^3.2", "symfony/event-dispatcher": "^3.0", "symfony/filesystem": "^3.0", "symfony/finder": "^3.0", @@ -1814,6 +1814,7 @@ "require-dev": { "johnkary/phpunit-speedtrap": "^1.1", "justinrainbow/json-schema": "^5.0", + "php-cs-fixer/accessible-object": "^1.0", "phpunit/phpunit": "^4.8.35 || ^5.4.3", "satooshi/php-coveralls": "^1.0", "symfony/phpunit-bridge": "^3.2.2" @@ -1826,11 +1827,6 @@ "php-cs-fixer" ], "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -1858,7 +1854,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-08-22T14:11:01+00:00" + "time": "2017-08-22T14:15:09+00:00" }, { "name": "gecko-packages/gecko-php-unit", diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php index 5a46e369418ac07010ae2e245f430f1f690c3cfe..d196b4d32a16c8105bab0539762d08aede9fac74 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php @@ -114,16 +114,15 @@ class ClearCacheToolbarItem implements ToolbarItemInterface { if ($this->hasDropDown()) { return $this->getFluidTemplateObject('ClearCacheToolbarItem.html')->render(); - } else { - $view = $this->getFluidTemplateObject('ClearCacheToolbarItemSingle.html'); - $cacheAction = end($this->cacheActions); - $view->assignMultiple([ + } + $view = $this->getFluidTemplateObject('ClearCacheToolbarItemSingle.html'); + $cacheAction = end($this->cacheActions); + $view->assignMultiple([ 'link' => $cacheAction['href'], 'title' => $cacheAction['title'], 'iconIdentifier' => $cacheAction['iconIdentifier'], ]); - return $view->render(); - } + return $view->render(); } /** diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php index 3ffc2e52ddd858623fff5070b5e239edfc2cde2b..c7f8b60062cf3280e184d8ab9b307fbbb69bad61 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php @@ -655,9 +655,8 @@ class ShortcutToolbarItem implements ToolbarItemInterface if ($affectedRows === 1) { return 'success'; - } else { - return 'failed'; } + return 'failed'; } /** diff --git a/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php b/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php index 834d2b04d96b408c3195b4f6898a511db21b13ec..17a3661e2c1cbb4b80521de8ea08e45b7cbbaf6a 100644 --- a/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php +++ b/typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php @@ -47,8 +47,8 @@ class ConditionMatcher extends AbstractConditionMatcher $result = $this->evaluateConditionCommon($key, $value); if (is_bool($result)) { return $result; - } else { - switch ($key) { + } + switch ($key) { case 'usergroup': $groupList = $this->getGroupList(); $values = GeneralUtility::trimExplode(',', $value, true); @@ -95,7 +95,7 @@ class ConditionMatcher extends AbstractConditionMatcher return $conditionResult; } } - } + return false; } diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index 1c5bcf4f9ff4e10aee14405605712d54045f0fda..2c5200d2db7e5267e9b8fc21e3a295fcb39d134e 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -775,9 +775,8 @@ class BackendController // start in module: top.startInModule = [' . GeneralUtility::quoteJSvalue($startModule) . ', ' . GeneralUtility::quoteJSvalue($moduleParameters) . ']; '; - } else { - return ''; } + return ''; } /** diff --git a/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php b/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php index c977cddee45014cbd5f53ba1bbceda42e0244d3b..a0b1b9cb697562c0138129ebfcacfae3398a8fdc 100644 --- a/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php +++ b/typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php @@ -508,12 +508,11 @@ class NewContentElementController extends AbstractModule // Remove element all together: unset($wizardItems[$key]); break; - } else { - // Add the parameter: - $wizardItems[$key]['params'] .= '&defVals[tt_content][' . $fN . ']=' . rawurlencode($this->getLanguageService()->sL($fV)); - $tmp = explode('_', $key); - $headersUsed[$tmp[0]] = $tmp[0]; } + // Add the parameter: + $wizardItems[$key]['params'] .= '&defVals[tt_content][' . $fN . ']=' . rawurlencode($this->getLanguageService()->sL($fV)); + $tmp = explode('_', $key); + $headersUsed[$tmp[0]] = $tmp[0]; } } } diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index be023af327ae0cde0abb57000731821a254cb07e..952a8f5bfab9914ba2c987e655c6de3dd5714847 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -1804,30 +1804,26 @@ class EditDocumentController extends AbstractModule // that is handled inside DataHandler then and in the interface it would clearly be an error of // links if the user accesses such a scenario) return $reqRecord; - } else { - // The input record was online and an offline version must be found or made: - // Look for version of this workspace: - $versionRec = BackendUtility::getWorkspaceVersionOfRecord( + } + // The input record was online and an offline version must be found or made: + // Look for version of this workspace: + $versionRec = BackendUtility::getWorkspaceVersionOfRecord( $this->getBackendUser()->workspace, $table, $reqRecord['uid'], 'uid,pid,t3ver_oid' ); - return is_array($versionRec) ? $versionRec : $reqRecord; - } - } else { - // This means that editing cannot occur on this record because it was not supporting versioning - // which is required inside an offline workspace. - return false; + return is_array($versionRec) ? $versionRec : $reqRecord; } - } else { - // In ONLINE workspace, just return the originally requested record: - return $reqRecord; + // This means that editing cannot occur on this record because it was not supporting versioning + // which is required inside an offline workspace. + return false; } - } else { - // Return FALSE because the table/uid was not found anyway. - return false; + // In ONLINE workspace, just return the originally requested record: + return $reqRecord; } + // Return FALSE because the table/uid was not found anyway. + return false; } /** diff --git a/typo3/sysext/backend/Classes/Controller/File/FileController.php b/typo3/sysext/backend/Classes/Controller/File/FileController.php index e61d290a92801b2e0d3221be627d92faea822db1..1c862bacf38e36186bbb928f0e861207064aa1eb 100644 --- a/typo3/sysext/backend/Classes/Controller/File/FileController.php +++ b/typo3/sysext/backend/Classes/Controller/File/FileController.php @@ -192,10 +192,9 @@ class FileController return $response ->withHeader('Location', GeneralUtility::locationHeaderUrl($this->redirect)) ->withStatus(303); - } else { - // empty response - return $response; } + // empty response + return $response; } /** diff --git a/typo3/sysext/backend/Classes/Controller/LoginController.php b/typo3/sysext/backend/Classes/Controller/LoginController.php index ba3b4202f616c34afad1d35d377c1ee91952b958..e080169dc24b8f8e14d43f74fb0ae54ceb4ffc28 100644 --- a/typo3/sysext/backend/Classes/Controller/LoginController.php +++ b/typo3/sysext/backend/Classes/Controller/LoginController.php @@ -273,10 +273,9 @@ class LoginController */ throw new \RuntimeException('Login-error: Yeah, that\'s a classic. No cookies, no TYPO3. ' . 'Please accept cookies from TYPO3 - otherwise you\'ll not be able to use the system.', 1294586846); - } else { - // try it once again - that might be needed for auto login - $this->redirectToURL = 'index.php?commandLI=setCookie'; } + // try it once again - that might be needed for auto login + $this->redirectToURL = 'index.php?commandLI=setCookie'; } $redirectToUrl = (string)$this->getBackendUserAuthentication()->getTSConfigVal('auth.BE.redirectToURL'); if (empty($redirectToUrl)) { diff --git a/typo3/sysext/backend/Classes/Controller/NewRecordController.php b/typo3/sysext/backend/Classes/Controller/NewRecordController.php index 56e70443fada98ffef8709b8f11e0f597f75b8c9..dd18ae0ca1ae6bd5ff00669b960f3af3a4c9d23e 100644 --- a/typo3/sysext/backend/Classes/Controller/NewRecordController.php +++ b/typo3/sysext/backend/Classes/Controller/NewRecordController.php @@ -622,10 +622,9 @@ class NewRecordController extends AbstractModule $ret = strnatcasecmp($this->tRows[$a]['title'], $this->tRows[$b]['title']); } return $ret; - } else { - // Return alphabetic order - return strnatcasecmp($this->tRows[$a]['title'], $this->tRows[$b]['title']); } + // Return alphabetic order + return strnatcasecmp($this->tRows[$a]['title'], $this->tRows[$b]['title']); } /** diff --git a/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php b/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php index 8fcb109f80b48227d9ad3b3119bdbaafcf3e3026..fc5345a4bb1be0c31474144c7fc46aa9610e73dc 100644 --- a/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php +++ b/typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php @@ -164,19 +164,18 @@ class NewMultiplePagesController foreach ($newPagesData as $identifier => $data) { if (!trim($data['title'])) { continue; + } + $commandArray['pages'][$identifier]['hidden'] = $hidePages; + $commandArray['pages'][$identifier]['nav_hide'] = $hidePagesInMenu; + $commandArray['pages'][$identifier]['title'] = $data['title']; + $commandArray['pages'][$identifier]['doktype'] = $data['doktype']; + if ($firstRecord) { + $firstRecord = false; + $commandArray['pages'][$identifier]['pid'] = $firstPid; } else { - $commandArray['pages'][$identifier]['hidden'] = $hidePages; - $commandArray['pages'][$identifier]['nav_hide'] = $hidePagesInMenu; - $commandArray['pages'][$identifier]['title'] = $data['title']; - $commandArray['pages'][$identifier]['doktype'] = $data['doktype']; - if ($firstRecord) { - $firstRecord = false; - $commandArray['pages'][$identifier]['pid'] = $firstPid; - } else { - $commandArray['pages'][$identifier]['pid'] = '-' . $previousIdentifier; - } - $previousIdentifier = $identifier; + $commandArray['pages'][$identifier]['pid'] = '-' . $previousIdentifier; } + $previousIdentifier = $identifier; } if (!empty($commandArray)) { diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index 4e0599812c3fc4382f63c319142bffd1f60909ce..fdf5f593be8353b2eb80cdcf2d2ce9f9d741e83d 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -653,9 +653,8 @@ class PageLayoutController ->execute() ->fetch(); return $overlayRecord['title']; - } else { - return $this->pageinfo['title']; } + return $this->pageinfo['title']; } /** diff --git a/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php b/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php index d89d444882580bce5f21c4c2ea8ae98db4df05bc..776868b4199eb437e1c33c19aca8b223eade1871 100644 --- a/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php +++ b/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php @@ -356,8 +356,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface if ($iconRegistry->isRegistered($iconIdentifier)) { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); return $iconFactory->getIcon($iconIdentifier)->render(); - } else { - return ''; } + return ''; } } diff --git a/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php b/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php index 3e1e90d551d3aeb04a6f9428067f77a6d482123d..2d05b34f9fe869ec2792f18d5ea52013d1257b15 100644 --- a/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php @@ -232,9 +232,8 @@ class PaletteAndSingleContainer extends AbstractContainer if ($foundRealElement) { return $resultStructure; - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/backend/Classes/Form/FieldWizard/OtherLanguageContent.php b/typo3/sysext/backend/Classes/Form/FieldWizard/OtherLanguageContent.php index 68a5a7233a3c55aee3d77072725abca72c731c85..ae8c471bad97b4420c52322b9a1501e763775c30 100644 --- a/typo3/sysext/backend/Classes/Form/FieldWizard/OtherLanguageContent.php +++ b/typo3/sysext/backend/Classes/Form/FieldWizard/OtherLanguageContent.php @@ -146,8 +146,7 @@ class OtherLanguageContent extends AbstractNode '</span>'; } return implode('<br />', $imgs); - } else { - return nl2br(htmlspecialchars($value)); } + return nl2br(htmlspecialchars($value)); } } diff --git a/typo3/sysext/backend/Classes/Form/FieldWizard/SelectIcons.php b/typo3/sysext/backend/Classes/Form/FieldWizard/SelectIcons.php index 263c33b40d935b1317bb129b48be83dff07c6c17..48adc32dc099bb05a39f8980c36615eef58860fb 100644 --- a/typo3/sysext/backend/Classes/Form/FieldWizard/SelectIcons.php +++ b/typo3/sysext/backend/Classes/Form/FieldWizard/SelectIcons.php @@ -40,17 +40,16 @@ class SelectIcons extends AbstractNode foreach ($selectItems as $item) { if ($item[1] === '--div--') { continue; - } else { - $icon = !empty($item[2]) ? FormEngineUtility::getIconHtml($item[2], $item[0], $item[0]) : ''; - if ($icon) { - $selectIcons[] = [ + } + $icon = !empty($item[2]) ? FormEngineUtility::getIconHtml($item[2], $item[0], $item[0]) : ''; + if ($icon) { + $selectIcons[] = [ 'title' => $item[0], 'icon' => $icon, 'index' => $selectItemCounter, ]; - } - $selectItemCounter++; } + $selectItemCounter++; } $html = []; diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDateTimeFields.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDateTimeFields.php index 6645476d47cbe7b7cbacc0ecc2c421073bf9ee25..67d3e1b5fe6e50715ede42162b165db3dfb4d893 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDateTimeFields.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDateTimeFields.php @@ -45,10 +45,9 @@ class DatabaseRowDateTimeFields implements FormDataProviderInterface } else { $result['databaseRow'][$column] = null; } - } else { - // its a UNIX timestamp! We do not modify this here, as it will only be treated as a datetime because - // of eval being set to "date" or "datetime". This is handled in InputTextElement then. } + // its a UNIX timestamp! We do not modify this here, as it will only be treated as a datetime because + // of eval being set to "date" or "datetime". This is handled in InputTextElement then. } return $result; } diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php index ebfc873f2a9b96c10588ae19371c7d64b2d62156..362791e84867d2d528d5c323c9b5aa573fccf682 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php @@ -874,9 +874,8 @@ class EvaluateDisplayConditions implements FormDataProviderInterface { if ($condition['isNew']) { return !((int)$condition['uid'] > 0); - } else { - return (int)$condition['uid'] > 0; } + return (int)$condition['uid'] > 0; } /** diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php index e0a96908f05a480d20b8b03f152e13844ada9fd9..ac4b044ecebb5350b6da056d960c0e4ef4c40b9c 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaColumnsProcessFieldLabels.php @@ -68,7 +68,8 @@ class TcaColumnsProcessFieldLabels implements FormDataProviderInterface if ($aShowItemFieldArray['fieldName'] === '--div--') { // tabs are not of interest here continue; - } elseif ($aShowItemFieldArray['fieldName'] === '--palette--') { + } + if ($aShowItemFieldArray['fieldName'] === '--palette--') { // showitem references to a palette field. unpack the palette and process // label overrides that may be in there. if (!isset($result['processedTca']['palettes'][$aShowItemFieldArray['paletteName']]['showitem'])) { diff --git a/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php b/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php index e0e5b0798633a2ce7457dc9cb449269aee027861..790f93e548828e11f0dd2ea2ce664299344613b9 100644 --- a/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php +++ b/typo3/sysext/backend/Classes/Form/InlineStackProcessor.php @@ -193,9 +193,8 @@ class InlineStackProcessor if ($level !== false) { return $this->inlineStructure['stable'][$level]; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php b/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php index 112d956bd0d98b581c248a76ddd21c0205f665a4..0c0d15096027d8644f7be8d32f7a179c1c4998a3 100644 --- a/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php +++ b/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php @@ -74,9 +74,8 @@ class ImageManipulationWizard $response->getBody()->write($content); return $response; - } else { - return $response->withStatus(403); } + return $response->withStatus(403); } /** diff --git a/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php b/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php index 91a86b9e8ddbabcd290e6bf139cb2ccb12abf89a..0f6a912f823256b038c44c38cee6f1422d76b0d6 100644 --- a/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php +++ b/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php @@ -326,16 +326,15 @@ abstract class AbstractRecordList $code = $this->addElement(1, '', $theData, 'class="fwd_rwd_nav"'); } return [1, $code]; - } else { - if ($this->eCounter == $this->firstElementNumber + $this->iLimit) { - // Forward - $theData = []; - $titleCol = $this->fieldArray[0]; - $theData[$titleCol] = $this->fwd_rwd_HTML('rwd', $this->eCounter, $table); - $code = $this->addElement(1, '', $theData, 'class="fwd_rwd_nav"'); - } - return [0, $code]; } + if ($this->eCounter == $this->firstElementNumber + $this->iLimit) { + // Forward + $theData = []; + $titleCol = $this->fieldArray[0]; + $theData[$titleCol] = $this->fwd_rwd_HTML('rwd', $this->eCounter, $table); + $code = $this->addElement(1, '', $theData, 'class="fwd_rwd_nav"'); + } + return [0, $code]; } /** diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php b/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php index 21d7185290d693bedf49850cbbc35235346e3f95..78aebab371aef6cc9612efe4b2c6367c5d3745f8 100644 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php +++ b/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php @@ -218,7 +218,8 @@ class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider $records = $this->getSubpages(-1, $searchFilter); if (!is_array($records) || empty($records)) { return $nodeCollection; - } elseif (count($records) > 500) { + } + if (count($records) > 500) { return $nodeCollection; } // check no temporary mountpoint is used diff --git a/typo3/sysext/backend/Classes/Tree/SortedTreeNodeCollection.php b/typo3/sysext/backend/Classes/Tree/SortedTreeNodeCollection.php index 8f46e581bd75f8896607f31113a86c4668b05629..83bf446e56b1905e110d4bdd13ae0ab7366d1da5 100644 --- a/typo3/sysext/backend/Classes/Tree/SortedTreeNodeCollection.php +++ b/typo3/sysext/backend/Classes/Tree/SortedTreeNodeCollection.php @@ -58,20 +58,19 @@ class SortedTreeNodeCollection extends \TYPO3\CMS\Backend\Tree\TreeNodeCollectio $divider = ceil(($end - $start) / 2); if ($this->offsetGet($divider)->equals($node)) { return $divider; - } elseif ($this->offsetGet($divider)->compareTo($node) > 0) { - return $this->binarySearch($node, $start, $divider - 1); - } else { - return $this->binarySearch($node, $divider + 1, $end); } - } else { - if ($this->offsetGet($start)->equals($node)) { - return $start; - } elseif ($this->offsetGet($end)->equals($node)) { - return $end; - } else { - return -1; + if ($this->offsetGet($divider)->compareTo($node) > 0) { + return $this->binarySearch($node, $start, $divider - 1); } + return $this->binarySearch($node, $divider + 1, $end); + } + if ($this->offsetGet($start)->equals($node)) { + return $start; + } + if ($this->offsetGet($end)->equals($node)) { + return $end; } + return -1; } /** diff --git a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php index bb58c70c07fb9c0815eef0ab58d3b942b6c34351..2564e31bf185bd0cece9144e9939caa3d5f39c9c 100644 --- a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php @@ -510,9 +510,8 @@ abstract class AbstractTreeView $cmd = $this->bank . '_' . ($isOpen ? '0_' : '1_') . $row['uid'] . '_' . $this->treeName; $bMark = $this->bank . '_' . $row['uid']; return $this->PM_ATagWrap('', $cmd, $bMark, $isOpen); - } else { - return ''; } + return ''; } /** @@ -532,9 +531,8 @@ abstract class AbstractTreeView $name = $bMark ? ' name="' . $bMark . '"' : ''; $aUrl = $this->getThisScript() . 'PM=' . $cmd . $anchor; return '<a class="list-tree-control ' . ($isOpen ? 'list-tree-control-open' : 'list-tree-control-closed') . '" href="' . htmlspecialchars($aUrl) . '"' . $name . '><i class="fa"></i></a>'; - } else { - return $icon; } + return $icon; } /** @@ -846,13 +844,13 @@ abstract class AbstractTreeView if (is_array($this->data)) { $res = $this->getDataInit($uid); return $this->getDataCount($res); - } else { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table); - $queryBuilder->getRestrictions() + } + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table); + $queryBuilder->getRestrictions() ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); - $count = $queryBuilder + $count = $queryBuilder ->count('uid') ->from($this->table) ->where( @@ -865,8 +863,7 @@ abstract class AbstractTreeView ->execute() ->fetchColumn(); - return (int)$count; - } + return (int)$count; } /** @@ -891,9 +888,8 @@ abstract class AbstractTreeView { if (is_array($this->data)) { return $this->dataLookup[$uid]; - } else { - return BackendUtility::getRecordWSOL($this->table, $uid); } + return BackendUtility::getRecordWSOL($this->table, $uid); } /** @@ -915,13 +911,13 @@ abstract class AbstractTreeView reset($this->dataLookup[$parentId][$this->subLevelID]); } return $parentId; - } else { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table); - $queryBuilder->getRestrictions() + } + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table); + $queryBuilder->getRestrictions() ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); - $queryBuilder + $queryBuilder ->select(...$this->fieldArray) ->from($this->table) ->where( @@ -932,13 +928,12 @@ abstract class AbstractTreeView QueryHelper::stripLogicalOperatorPrefix($this->clause) ); - foreach (QueryHelper::parseOrderBy($this->orderByFields) as $orderPair) { - list($fieldName, $order) = $orderPair; - $queryBuilder->addOrderBy($fieldName, $order); - } - - return $queryBuilder->execute(); + foreach (QueryHelper::parseOrderBy($this->orderByFields) as $orderPair) { + list($fieldName, $order) = $orderPair; + $queryBuilder->addOrderBy($fieldName, $order); } + + return $queryBuilder->execute(); } /** @@ -953,9 +948,8 @@ abstract class AbstractTreeView { if (is_array($this->data)) { return count($this->dataLookup[$res][$this->subLevelID]); - } else { - return $res->rowCount(); } + return $res->rowCount(); } /** @@ -976,15 +970,14 @@ abstract class AbstractTreeView list(, $row) = each($this->dataLookup[$res][$this->subLevelID]); } return $row; - } else { - while ($row = $res->fetch()) { - BackendUtility::workspaceOL($this->table, $row, $this->BE_USER->workspace, true); - if (is_array($row)) { - break; - } + } + while ($row = $res->fetch()) { + BackendUtility::workspaceOL($this->table, $row, $this->BE_USER->workspace, true); + if (is_array($row)) { + break; } - return $row; } + return $row; } /** diff --git a/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php b/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php index 2c0f246747265b9620d3c6aea38ca5b8a88a57aa..95b0ca83bf8a806a349e52fbd136cb6b52db7b6a 100644 --- a/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php +++ b/typo3/sysext/backend/Classes/Tree/View/ContentLayoutPagePositionMap.php @@ -94,9 +94,8 @@ class ContentLayoutPagePositionMap extends PagePositionMap /** @var IconFactory $iconFactory */ $iconFactory = GeneralUtility::makeInstance(IconFactory::class); return $iconFactory->getIcon('status-status-current', Icon::SIZE_SMALL)->render() . $str; - } else { - return $str; } + return $str; } /** diff --git a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php index 37963cd187fed23e3b2d324804fac0c4fa8c771c..15392f6346565f286277e37f9ec6985c7d9732f1 100644 --- a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php @@ -84,9 +84,8 @@ class ElementBrowserFolderTreeView extends FolderTreeView if ($this->ext_isLinkable($folderObject)) { $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()])); return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>'; - } else { - return '<span class="text-muted">' . $title . '</span>'; } + return '<span class="text-muted">' . $title . '</span>'; } /** diff --git a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php index dc6fe6fb721228c90840b2c99fb684b353557c97..ab6780b1f9c32b2a202d690bd812fe9dd1669fda 100644 --- a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php @@ -76,9 +76,8 @@ class ElementBrowserPageTreeView extends BrowseTreeView if ($this->ext_isLinkable($v['doktype'], $v['uid'])) { $url = GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_PAGE, 'pageuid' => (int)$v['uid']]); return '<span class="list-tree-title"><a href="' . htmlspecialchars($url) . '" class="t3js-pageLink">' . $title . '</a></span>'; - } else { - return '<span class="list-tree-title text-muted">' . $title . '</span>'; } + return '<span class="list-tree-title text-muted">' . $title . '</span>'; } /** diff --git a/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php b/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php index c8e272f150d9f5be18941bcaee902e2426ca67aa..b0875677ab0a5b638364f5aff61ba47a28b3b7d1 100644 --- a/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php @@ -146,9 +146,8 @@ class FolderTreeView extends AbstractTreeView $scopeHash = GeneralUtility::hmac($scopeData); $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');'); return '<a class="list-tree-control' . (!$isExpand ? ' list-tree-control-open' : ' list-tree-control-closed') . '" onclick="' . $js . '"><i class="fa"></i></a>'; - } else { - return $icon; } + return $icon; } /** @@ -644,12 +643,10 @@ class FolderTreeView extends AbstractTreeView if ($storageObject) { if ($startingPointFolder) { return $this->storageHashNumbers[$storageObject->getUid() . $startingPointFolder->getCombinedIdentifier()]; - } else { - return $this->storageHashNumbers[$storageObject->getUid()]; } - } else { - return null; + return $this->storageHashNumbers[$storageObject->getUid()]; } + return null; } /** diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 68055be0e429e4564dcbe96772ea17d16853fa7b..103a2feb361be0fde0a3ff1d8b6b2e272ac8b626 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -539,9 +539,8 @@ class BackendUtility } if ($fullTitleLimit) { return [$output, $fullOutput]; - } else { - return $output; } + return $output; } /** @@ -851,74 +850,74 @@ class BackendUtility && isset($pagesTSconfig_cacheReference[$id]) ) { return $combinedTSconfig_cache[$pagesTSconfig_cacheReference[$id]]; + } + $TSconfig = []; + if (!is_array($rootLine)) { + $useCacheForCurrentPageId = true; + $rootLine = self::BEgetRootLine($id, '', true); } else { - $TSconfig = []; - if (!is_array($rootLine)) { - $useCacheForCurrentPageId = true; - $rootLine = self::BEgetRootLine($id, '', true); - } else { - $useCacheForCurrentPageId = false; - } - - // Order correctly - ksort($rootLine); - $TSdataArray = []; - // Setting default configuration - $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; - foreach ($rootLine as $k => $v) { - if (trim($v['tsconfig_includes'])) { - $includeTsConfigFileList = GeneralUtility::trimExplode(',', $v['tsconfig_includes'], true); - // Traversing list - foreach ($includeTsConfigFileList as $key => $includeTsConfigFile) { - if (strpos($includeTsConfigFile, 'EXT:') === 0) { - list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode( + $useCacheForCurrentPageId = false; + } + + // Order correctly + ksort($rootLine); + $TSdataArray = []; + // Setting default configuration + $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; + foreach ($rootLine as $k => $v) { + if (trim($v['tsconfig_includes'])) { + $includeTsConfigFileList = GeneralUtility::trimExplode(',', $v['tsconfig_includes'], true); + // Traversing list + foreach ($includeTsConfigFileList as $key => $includeTsConfigFile) { + if (strpos($includeTsConfigFile, 'EXT:') === 0) { + list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode( '/', substr($includeTsConfigFile, 4), 2 ); - if ((string)$includeTsConfigFileExtensionKey !== '' + if ((string)$includeTsConfigFileExtensionKey !== '' && ExtensionManagementUtility::isLoaded($includeTsConfigFileExtensionKey) && (string)$includeTsConfigFilename !== '' ) { - $includeTsConfigFileAndPath = ExtensionManagementUtility::extPath($includeTsConfigFileExtensionKey) . + $includeTsConfigFileAndPath = ExtensionManagementUtility::extPath($includeTsConfigFileExtensionKey) . $includeTsConfigFilename; - if (file_exists($includeTsConfigFileAndPath)) { - $TSdataArray['uid_' . $v['uid'] . '_static_' . $key] = file_get_contents($includeTsConfigFileAndPath); - } + if (file_exists($includeTsConfigFileAndPath)) { + $TSdataArray['uid_' . $v['uid'] . '_static_' . $key] = file_get_contents($includeTsConfigFileAndPath); } } } } - $TSdataArray['uid_' . $v['uid']] = $v['TSconfig']; - } - $TSdataArray = static::emitGetPagesTSconfigPreIncludeSignal($TSdataArray, $id, $rootLine, $returnPartArray); - $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray); - if ($returnPartArray) { - return $TSdataArray; } - // Parsing the page TS-Config - $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray); - /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */ - $parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TsConfigParser::class); - $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine); - if ($res) { - $TSconfig = $res['TSconfig']; - } - $cacheHash = $res['hash']; - // Get User TSconfig overlay - $userTSconfig = static::getBackendUserAuthentication()->userTS['page.']; - if (is_array($userTSconfig)) { - ArrayUtility::mergeRecursiveWithOverrule($TSconfig, $userTSconfig); - $cacheHash .= '_user' . $GLOBALS['BE_USER']->user['uid']; - } - - if ($useCacheForCurrentPageId) { - if (!isset($combinedTSconfig_cache[$cacheHash])) { - $combinedTSconfig_cache[$cacheHash] = $TSconfig; - } - $pagesTSconfig_cacheReference[$id] = $cacheHash; + $TSdataArray['uid_' . $v['uid']] = $v['TSconfig']; + } + $TSdataArray = static::emitGetPagesTSconfigPreIncludeSignal($TSdataArray, $id, $rootLine, $returnPartArray); + $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray); + if ($returnPartArray) { + return $TSdataArray; + } + // Parsing the page TS-Config + $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray); + /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */ + $parseObj = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TsConfigParser::class); + $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine); + if ($res) { + $TSconfig = $res['TSconfig']; + } + $cacheHash = $res['hash']; + // Get User TSconfig overlay + $userTSconfig = static::getBackendUserAuthentication()->userTS['page.']; + if (is_array($userTSconfig)) { + ArrayUtility::mergeRecursiveWithOverrule($TSconfig, $userTSconfig); + $cacheHash .= '_user' . $GLOBALS['BE_USER']->user['uid']; + } + + if ($useCacheForCurrentPageId) { + if (!isset($combinedTSconfig_cache[$cacheHash])) { + $combinedTSconfig_cache[$cacheHash] = $TSconfig; } + $pagesTSconfig_cacheReference[$id] = $cacheHash; } + return $TSconfig; } @@ -2239,9 +2238,8 @@ class BackendUtility } if ($fixed_lgd_chars) { return GeneralUtility::fixed_lgd_cs($l, $fixed_lgd_chars); - } else { - return $l; } + return $l; } /** @@ -3153,9 +3151,8 @@ class BackendUtility $beUser->pushModuleData($modName, $settings); } return $settings; - } else { - die('Wrong module name: "' . $modName . '"'); } + die('Wrong module name: "' . $modName . '"'); } /** @@ -3695,9 +3692,8 @@ class BackendUtility if ($count) { return $msg ? sprintf($msg, $count) : $count; - } else { - return $msg ? '' : 0; } + return $msg ? '' : 0; } /** @@ -3744,9 +3740,8 @@ class BackendUtility if ($count) { return $msg ? sprintf($msg, $count) : $count; - } else { - return $msg ? '' : 0; } + return $msg ? '' : 0; } /******************************************* diff --git a/typo3/sysext/backend/Classes/View/BackendLayoutView.php b/typo3/sysext/backend/Classes/View/BackendLayoutView.php index 4db68489c319402f6307209acda4617dcd7a6661..d2e15fc13375d3e1812c726223e73aa1b57a493f 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayoutView.php +++ b/typo3/sysext/backend/Classes/View/BackendLayoutView.php @@ -200,7 +200,8 @@ class BackendLayoutView implements \TYPO3\CMS\Core\SingletonInterface // If layout for "next level" is set to "none" - don't use any and stop searching $this->selectedCombinedIdentifier[$pageId] = false; break; - } elseif ($this->selectedCombinedIdentifier[$pageId] !== '' && $this->selectedCombinedIdentifier[$pageId] !== '0') { + } + if ($this->selectedCombinedIdentifier[$pageId] !== '' && $this->selectedCombinedIdentifier[$pageId] !== '0') { // Stop searching if a layout for "next level" is set break; } diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php index e5c72b0e7d2d1b141a236feeb5838b7073ae762f..3edd00be247bb8eab7a0671f154f1ea077969146 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutView.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php @@ -248,9 +248,9 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe { if (isset($this->externalTables[$table])) { return $this->getExternalTables($id, $table); - } else { - // Branch out based on table name: - switch ($table) { + } + // Branch out based on table name: + switch ($table) { case 'pages': return $this->getTable_pages($id); break; @@ -260,7 +260,6 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe default: return ''; } - } } /** @@ -1854,9 +1853,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe // Return values: if ($this->isDisabled('tt_content', $row)) { return '<span class="text-muted">' . $out . '</span>'; - } else { - return $out; } + return $out; } /** @@ -2048,9 +2046,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe $url = BackendUtility::getModuleUrl('record_edit', $urlParameters); // Return link return '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">' . $str . '</a>'; - } else { - return $str; } + return $str; } /** diff --git a/typo3/sysext/backend/Classes/View/PageTreeView.php b/typo3/sysext/backend/Classes/View/PageTreeView.php index e39ca1b8af9533f4bf3e3eb6662dceca66221356..e68d8874ca3e748491297afaf99de2461bccaab2 100644 --- a/typo3/sysext/backend/Classes/View/PageTreeView.php +++ b/typo3/sysext/backend/Classes/View/PageTreeView.php @@ -256,9 +256,8 @@ class PageTreeView extends BrowseTreeView // Activate dynamic ajax-based tree $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this);'); return '<a class="list-tree-control' . (!$isExpand ? ' list-tree-control-open' : ' list-tree-control-closed') . '" onclick="' . $js . '"><i class="fa"></i></a>'; - } else { - return $icon; } + return $icon; } /** diff --git a/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php b/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php index c75633e6c54cd4a02e3596c45d6a9f2558077afb..db58d08407f36ca1301f3b982ef2bc64207b86b6 100644 --- a/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php +++ b/typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php @@ -66,8 +66,7 @@ class ErrorIconViewHelper extends AbstractBackendViewHelper if ($errorSymbols[$arguments['errorNumber']]) { $iconFactory = GeneralUtility::makeInstance(IconFactory::class); return $iconFactory->getIcon($errorSymbols[$arguments['errorNumber']], Icon::SIZE_SMALL)->render(); - } else { - return ''; } + return ''; } } diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 0941a85050b243e6b62cf3e9674470ad9dfd2b07..34b0e3fcd12bf4ef32f8d4f610686f9fbb870dbc 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -719,7 +719,8 @@ abstract class AbstractUserAuthentication if ((int)$ret >= 200) { $authenticated = true; break; - } elseif ((int)$ret >= 100) { + } + if ((int)$ret >= 100) { } else { $authenticated = true; } @@ -1142,14 +1143,13 @@ abstract class AbstractUserAuthentication $IP = GeneralUtility::getIndpEnv('REMOTE_ADDR'); if ($parts >= 4) { return $IP; - } else { - $parts = MathUtility::forceIntegerInRange($parts, 1, 3); - $IPparts = explode('.', $IP); - for ($a = 4; $a > $parts; $a--) { - unset($IPparts[$a - 1]); - } - return implode('.', $IPparts); } + $parts = MathUtility::forceIntegerInRange($parts, 1, 3); + $IPparts = explode('.', $IP); + for ($a = 4; $a > $parts; $a--) { + unset($IPparts[$a - 1]); + } + return implode('.', $IPparts); } /************************* diff --git a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php index f552fb35e401b00acb4e962ea46fb3f7b14a8b5d..3fc78ee694e53d3c43c8aaf8cba02930d39e8d32 100644 --- a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php @@ -437,9 +437,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication } if (!$acs && $exitOnError) { throw new \RuntimeException('Access Error: You don\'t have access to this module.', 1294586448); - } else { - return $acs; } + return $acs; } /** @@ -515,9 +514,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication } } return $constraint; - } else { - return ' 1=0'; } + return ' 1=0'; } /** @@ -770,7 +768,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication if (!$this->checkLanguageAccess($idOrRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) { $this->errorMsg = 'ERROR: Language was not allowed.'; return false; - } elseif ( + } + if ( $checkFullLanguageAccess && $idOrRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']] == 0 && !$this->checkFullLanguagesAccess($table, $idOrRow) ) { @@ -916,36 +915,32 @@ class BackendUserAuthentication extends AbstractUserAuthentication // No versioning, basic error, inconsistency even! Such records should not have a pid of -1! if (!$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { return 'Versioning disabled for table'; - } elseif ((int)$recData['t3ver_wsid'] !== $this->workspace) { + } + if ((int)$recData['t3ver_wsid'] !== $this->workspace) { // So does workspace match? return 'Workspace ID of record didn\'t match current workspace'; - } else { - // So is the user allowed to "use" the edit stage within the workspace? - return $this->workspaceCheckStageForCurrent(0) + } + // So is the user allowed to "use" the edit stage within the workspace? + return $this->workspaceCheckStageForCurrent(0) ? false : 'User\'s access level did not allow for editing'; - } - } else { - // We are testing a "live" record: - // For "Live" records, check that PID for table allows editing - if ($res = $this->workspaceAllowLiveRecordsInPID($recData['pid'], $table)) { - // Live records are OK in this branch, but what about the stage of branch point, if any: - // OK - return $res > 0 + } + // We are testing a "live" record: + // For "Live" records, check that PID for table allows editing + if ($res = $this->workspaceAllowLiveRecordsInPID($recData['pid'], $table)) { + // Live records are OK in this branch, but what about the stage of branch point, if any: + // OK + return $res > 0 ? false : 'Stage for versioning root point and users access level did not allow for editing'; - } else { - // If not offline and not in versionized branch, output error: - return 'Online record was not in versionized branch!'; - } } - } else { - return 'No record'; + // If not offline and not in versionized branch, output error: + return 'Online record was not in versionized branch!'; } - } else { - // OK because workspace is 0 - return false; + return 'No record'; } + // OK because workspace is 0 + return false; } /** @@ -965,15 +960,12 @@ class BackendUserAuthentication extends AbstractUserAuthentication if (is_array($recData)) { if ((int)$recData['pid'] === -1) { return $this->workspaceCannotEditRecord($table, $recData); - } else { - return 'Not an offline version'; } - } else { - return 'No record'; + return 'Not an offline version'; } - } else { - return 'Table does not support versioning.'; + return 'No record'; } + return 'Table does not support versioning.'; } /** @@ -998,10 +990,9 @@ class BackendUserAuthentication extends AbstractUserAuthentication ) { // OK to create for this table. return 2; - } else { - // If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning - return false; } + // If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning + return false; } /** @@ -1094,9 +1085,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication } elseif ($stage == -10 || $stage == -20) { if ($stat['_ACCESS'] === 'owner') { return true; - } else { - return false; } + return false; } else { $memberStageLimit = $this->workspaceRec['review_stage_edit'] ? 1 : 0; if ( @@ -1159,9 +1149,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication { if ($this->workspace > 0 && (int)$this->workspaceRec['swap_modes'] === 2) { return false; - } else { - return true; } + return true; } /** @@ -1962,9 +1951,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication if ($uploadFolder instanceof \TYPO3\CMS\Core\Resource\Folder) { return $uploadFolder; - } else { - return false; } + return false; } /** @@ -2097,8 +2085,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication if (is_array($wsRec)) { if ($this->isAdmin()) { return array_merge($wsRec, ['_ACCESS' => 'admin']); - } else { - switch ((string)$wsRec['uid']) { + } + switch ((string)$wsRec['uid']) { case '0': $retVal = $this->groupData['workspace_perms'] & Permission::PAGE_SHOW ? array_merge($wsRec, ['_ACCESS' => 'online']) @@ -2136,7 +2124,6 @@ class BackendUserAuthentication extends AbstractUserAuthentication } } } - } } return $retVal; } diff --git a/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php b/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php index dc6cfa28875331974e8043fb7db0b11d79777adc..508873cbc8467c051c926f9f04d2afe4625692b9 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php @@ -208,9 +208,8 @@ class ApcBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend implement $identifiers = apc_fetch($this->getIdentifierPrefix() . 'tag_' . $tag, $success); if ($success === false) { return []; - } else { - return (array)$identifiers; } + return (array)$identifiers; } /** diff --git a/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php b/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php index 3e550b13bd4b65c448785262f23aa633b7e05803..b9eb0c055f4daecc666e3143c33c338a72f048fb 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/ApcuBackend.php @@ -208,9 +208,8 @@ class ApcuBackend extends AbstractBackend implements TaggableBackendInterface $identifiers = apcu_fetch($this->getIdentifierPrefix() . 'tag_' . $tag, $success); if ($success === false) { return []; - } else { - return (array)$identifiers; } + return (array)$identifiers; } /** diff --git a/typo3/sysext/core/Classes/Cache/Backend/FileBackend.php b/typo3/sysext/core/Classes/Cache/Backend/FileBackend.php index 534386c3b368919a095e53c4bf7fe9731347f651..28172198c6ae76adfd47973c1b4601c8c73eb04d 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/FileBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/FileBackend.php @@ -376,15 +376,13 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem if ($this->frozen === true) { if (isset($this->cacheEntryIdentifiers[$entryIdentifier])) { return require_once $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension; - } else { - return false; - } - } else { - if ($entryIdentifier !== basename($entryIdentifier)) { - throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1282073036); } - $pathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension; - return $this->isCacheFileExpired($pathAndFilename) ? false : require_once $pathAndFilename; + return false; } + if ($entryIdentifier !== basename($entryIdentifier)) { + throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1282073036); + } + $pathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension; + return $this->isCacheFileExpired($pathAndFilename) ? false : require_once $pathAndFilename; } } diff --git a/typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php b/typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php index 7dbd47aa793e426698765bf369cc7e767027b59d..803bc18cfc249c5109dab07d7f72615d101ffe80 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php @@ -278,9 +278,8 @@ class MemcachedBackend extends AbstractBackend implements TaggableBackendInterfa { if ($this->usedPeclModule === 'memcache') { return $this->memcache->set($this->identifierPrefix . $entryIdentifier, $data, $this->flags, $expiration); - } else { - return $this->memcache->set($this->identifierPrefix . $entryIdentifier, $data, $expiration); } + return $this->memcache->set($this->identifierPrefix . $entryIdentifier, $data, $expiration); } /** @@ -349,9 +348,8 @@ class MemcachedBackend extends AbstractBackend implements TaggableBackendInterfa $identifiers = $this->memcache->get($this->identifierPrefix . 'tag_' . $tag); if ($identifiers !== false) { return (array)$identifiers; - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/core/Classes/Cache/Backend/TransientMemoryBackend.php b/typo3/sysext/core/Classes/Cache/Backend/TransientMemoryBackend.php index 6fc76bc39401804e19ee601657cad49ef8435910..46fde70b59594bfe743c6646936b763574f2249c 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/TransientMemoryBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/TransientMemoryBackend.php @@ -95,9 +95,8 @@ class TransientMemoryBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBacke } } return true; - } else { - return false; } + return false; } /** @@ -112,9 +111,8 @@ class TransientMemoryBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBacke { if (isset($this->tagsAndEntries[$tag])) { return array_keys($this->tagsAndEntries[$tag]); - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/core/Classes/Cache/Backend/WincacheBackend.php b/typo3/sysext/core/Classes/Cache/Backend/WincacheBackend.php index b04eb2d8785b669650d90f0d330bfbacfc8a449c..982d697932486dd0042ed46673335374c9af4800 100644 --- a/typo3/sysext/core/Classes/Cache/Backend/WincacheBackend.php +++ b/typo3/sysext/core/Classes/Cache/Backend/WincacheBackend.php @@ -139,9 +139,8 @@ class WincacheBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend impl $identifiers = wincache_ucache_get($this->identifierPrefix . 'tag_' . $tag, $success); if ($success === false) { return []; - } else { - return (array)$identifiers; } + return (array)$identifiers; } /** diff --git a/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php b/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php index 92c8ee76d52fd2de2a67c798ba3476e4caff051e..bcb921d5e20d106c2b1d6eb1c186f8ff0ed116e0 100644 --- a/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php +++ b/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php @@ -83,9 +83,8 @@ class VariableFrontend extends AbstractFrontend $rawResult = $this->backend->get($entryIdentifier); if ($rawResult === false) { return false; - } else { - return $this->backend instanceof TransientBackendInterface ? $rawResult : unserialize($rawResult); } + return $this->backend instanceof TransientBackendInterface ? $rawResult : unserialize($rawResult); } /** diff --git a/typo3/sysext/core/Classes/Charset/CharsetConverter.php b/typo3/sysext/core/Classes/Charset/CharsetConverter.php index 6f2c6cf9edf4f8b306bde9505e5506397145f09b..ff1e60098fed2e87f399bb5a92d0c1dfae71f3e9 100644 --- a/typo3/sysext/core/Classes/Charset/CharsetConverter.php +++ b/typo3/sysext/core/Classes/Charset/CharsetConverter.php @@ -683,12 +683,10 @@ class CharsetConverter implements SingletonInterface } } return 2; - } else { - return false; } - } else { - return 1; + return false; } + return 1; } /** @@ -907,10 +905,9 @@ class CharsetConverter implements SingletonInterface $ord = hexdec($code_value); if ($ord > 127) { continue 2; - } else { - // Skip decompositions containing non-ASCII chars - $code_decomp[] = chr($ord); } + // Skip decompositions containing non-ASCII chars + $code_decomp[] = chr($ord); } $ascii[$this->UnumberToChar(hexdec($from))] = implode('', $code_decomp); } diff --git a/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php b/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php index 2e79e2472d651ca88bc9c13034c28e7022db0bc9..fe6a1c51b335124bfd3effec3f940324bceec050 100644 --- a/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php +++ b/typo3/sysext/core/Classes/Configuration/Loader/YamlFileLoader.php @@ -168,30 +168,30 @@ class YamlFileLoader // Simple lists get merged / added up if (count(array_filter(array_keys($val1), 'is_int')) === count($val1)) { return array_merge($val1, $val2); - } else { - foreach ($val1 as $k => $v) { - // The key also exists in second array, if it is a simple value - // then $val2 will override the value, where an array is calling merge() recursively. - if (isset($val2[$k])) { - if (is_array($v) && isset($val2[$k])) { - if (is_array($val2[$k])) { - $val1[$k] = $this->merge($v, $val2[$k]); - } else { - $val1[$k] = $val2[$k]; - } + } + foreach ($val1 as $k => $v) { + // The key also exists in second array, if it is a simple value + // then $val2 will override the value, where an array is calling merge() recursively. + if (isset($val2[$k])) { + if (is_array($v) && isset($val2[$k])) { + if (is_array($val2[$k])) { + $val1[$k] = $this->merge($v, $val2[$k]); } else { $val1[$k] = $val2[$k]; } - unset($val2[$k]); + } else { + $val1[$k] = $val2[$k]; } + unset($val2[$k]); } - // If there are properties in the second array left, they are added up - if (!empty($val2)) { - foreach ($val2 as $k => $v) { - $val1[$k] = $v; - } + } + // If there are properties in the second array left, they are added up + if (!empty($val2)) { + foreach ($val2 as $k => $v) { + $val1[$k] = $v; } } + return $val1; } } diff --git a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php index 3c5f21480a5b5486a690ce782e7c50ee45b2c2ac..1c67ec5f90dfbaa77b2d0a01c6db0f901cd793db 100644 --- a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php +++ b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php @@ -584,9 +584,8 @@ abstract class AbstractConditionMatcher } if (!is_array($theVar) && !is_object($theVar)) { return $theVar; - } else { - return ''; } + return ''; } /** diff --git a/typo3/sysext/core/Classes/Controller/FileDumpController.php b/typo3/sysext/core/Classes/Controller/FileDumpController.php index ab6dc3dcd5ea5cdffcaa71c0c2372be2029a140b..e64e42ba9c60b30dba30b409d1f94937974a73db 100644 --- a/typo3/sysext/core/Classes/Controller/FileDumpController.php +++ b/typo3/sysext/core/Classes/Controller/FileDumpController.php @@ -89,9 +89,8 @@ class FileDumpController $file->getStorage()->dumpFileContents($file); // @todo Refactor FAL to not echo directly, but to implement a stream for output here and use response return null; - } else { - return $response->withStatus(403); } + return $response->withStatus(403); } /** diff --git a/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php b/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php index 49465e484330e8cbf514249f276dfe25ff72cd93..b1e97d92937b69ed8464a765c0f78eba3e026af1 100644 --- a/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php +++ b/typo3/sysext/core/Classes/Core/ClassLoadingInformation.php @@ -152,9 +152,8 @@ class ClassLoadingInformation { if (self::isTestingContext()) { return PATH_site . self::AUTOLOAD_INFO_DIR_TESTS; - } else { - return PATH_site . self::AUTOLOAD_INFO_DIR; } + return PATH_site . self::AUTOLOAD_INFO_DIR; } /** diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index fb96fd2c6bca2555f72d9b593105797df73f227a..78c7149ea9b8bf24f300250446faf77b1d3b7eb3 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -5468,7 +5468,8 @@ class DataHandler } else { if ($pageIdsInBranch === -1) { return 'Attempt to delete page without permissions'; - } elseif ($pageIdsInBranch !== '') { + } + if ($pageIdsInBranch !== '') { return 'Attempt to delete page which has subpages'; } @@ -5499,9 +5500,8 @@ class DataHandler if ($table === 'pages') { $res = $this->canDeletePage($id); return is_array($res) ? false : $res; - } else { - return $this->doesRecordExist($table, $id, 'delete') ? false : 'No permission to delete record'; } + return $this->doesRecordExist($table, $id, 'delete') ? false : 'No permission to delete record'; } /** @@ -6495,14 +6495,15 @@ class DataHandler } if ($res === 1 || $res === 0) { return $res; - } else { - $res = 0; } + $res = 0; + if ($GLOBALS['TCA'][$table] && (int)$id > 0) { // If information is cached, return it if (isset($this->recUpdateAccessCache[$table][$id])) { return $this->recUpdateAccessCache[$table][$id]; - } elseif ($this->doesRecordExist($table, $id, 'edit')) { + } + if ($this->doesRecordExist($table, $id, 'edit')) { $res = 1; } // Cache the result @@ -6758,9 +6759,8 @@ class DataHandler BackendUtility::fixVersioningPid('pages', $row); if ($row['pid'] == $id) { return false; - } else { - $destinationId = (int)$row['pid']; } + $destinationId = (int)$row['pid']; } else { return false; } @@ -6970,9 +6970,8 @@ class DataHandler } } return false; - } else { - return $this->doesRecordExist_pageLookUp($id, $perms, $columns); } + return $this->doesRecordExist_pageLookUp($id, $perms, $columns); } return false; } @@ -7190,7 +7189,8 @@ class DataHandler $this->registerRecordIdForPageCacheClearing($table, $id); } return $id; - } elseif ($this->enableLogging) { + } + if ($this->enableLogging) { $this->log($table, $id, 1, 0, 2, 'SQL error: \'%s\' (%s)', 12, [$insertErrorMessage, $table . ':' . $id]); } } @@ -7350,19 +7350,17 @@ class DataHandler $this->resorting($table, $pid, $sortRow, 0); // First sorting number after resorting return $this->sortIntervals; - } else { - // Sorting number between current top element and zero - return floor($row[$sortRow] / 2); } - } else { - // No pages, so we choose the default value as sorting-number - // First sorting number if no elements. - return $this->sortIntervals; + // Sorting number between current top element and zero + return floor($row[$sortRow] / 2); } - } else { - // Sorting number is inside the list - // Fetches the record which is supposed to be the prev record - $row = $queryBuilder + // No pages, so we choose the default value as sorting-number + // First sorting number if no elements. + return $this->sortIntervals; + } + // Sorting number is inside the list + // Fetches the record which is supposed to be the prev record + $row = $queryBuilder ->where($queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter(abs($pid), \PDO::PARAM_INT) @@ -7370,24 +7368,24 @@ class DataHandler ->execute() ->fetch(); - // There was a record - if (!empty($row)) { - // Look, if the record UID happens to be an offline record. If so, find its live version. Offline uids will be used when a page is versionized as "branch" so this is when we must correct - otherwise a pid of "-1" and a wrong sort-row number is returned which we don't want. - if ($lookForLiveVersion = BackendUtility::getLiveVersionOfRecord($table, $row['uid'], $sortRow . ',pid,uid')) { - $row = $lookForLiveVersion; - } - // Fetch move placeholder, since it might point to a new page in the current workspace - if ($movePlaceholder = BackendUtility::getMovePlaceholder($table, $row['uid'], 'uid,pid,' . $sortRow)) { - $row = $movePlaceholder; - } - // If the record should be inserted after itself, keep the current sorting information: - if ((int)$row['uid'] === (int)$uid) { - $sortNumber = $row[$sortRow]; - } else { - $queryBuilder = $connectionPool->getQueryBuilderForTable($table); - $this->addDeleteRestriction($queryBuilder->getRestrictions()->removeAll()); + // There was a record + if (!empty($row)) { + // Look, if the record UID happens to be an offline record. If so, find its live version. Offline uids will be used when a page is versionized as "branch" so this is when we must correct - otherwise a pid of "-1" and a wrong sort-row number is returned which we don't want. + if ($lookForLiveVersion = BackendUtility::getLiveVersionOfRecord($table, $row['uid'], $sortRow . ',pid,uid')) { + $row = $lookForLiveVersion; + } + // Fetch move placeholder, since it might point to a new page in the current workspace + if ($movePlaceholder = BackendUtility::getMovePlaceholder($table, $row['uid'], 'uid,pid,' . $sortRow)) { + $row = $movePlaceholder; + } + // If the record should be inserted after itself, keep the current sorting information: + if ((int)$row['uid'] === (int)$uid) { + $sortNumber = $row[$sortRow]; + } else { + $queryBuilder = $connectionPool->getQueryBuilderForTable($table); + $this->addDeleteRestriction($queryBuilder->getRestrictions()->removeAll()); - $subResults = $queryBuilder + $subResults = $queryBuilder ->select($sortRow, 'pid', 'uid') ->from($table) ->where( @@ -7404,34 +7402,32 @@ class DataHandler ->setMaxResults(2) ->execute() ->fetchAll(); - // Fetches the next record in order to calculate the in-between sortNumber - // There was a record afterwards - if (count($subResults) === 2) { - // There was a record afterwards, fetch that - $subrow = array_pop($subResults); - // The sortNumber is found in between these values - $sortNumber = $row[$sortRow] + floor(($subrow[$sortRow] - $row[$sortRow]) / 2); - // The sortNumber happened NOT to be between the two surrounding numbers, so we'll have to resort the list - if ($sortNumber <= $row[$sortRow] || $sortNumber >= $subrow[$sortRow]) { - // By this special param, resorting reserves and returns the sortnumber after the uid - $sortNumber = $this->resorting($table, $row['pid'], $sortRow, $row['uid']); - } - } else { - // If after the last record in the list, we just add the sortInterval to the last sortvalue - $sortNumber = $row[$sortRow] + $this->sortIntervals; + // Fetches the next record in order to calculate the in-between sortNumber + // There was a record afterwards + if (count($subResults) === 2) { + // There was a record afterwards, fetch that + $subrow = array_pop($subResults); + // The sortNumber is found in between these values + $sortNumber = $row[$sortRow] + floor(($subrow[$sortRow] - $row[$sortRow]) / 2); + // The sortNumber happened NOT to be between the two surrounding numbers, so we'll have to resort the list + if ($sortNumber <= $row[$sortRow] || $sortNumber >= $subrow[$sortRow]) { + // By this special param, resorting reserves and returns the sortnumber after the uid + $sortNumber = $this->resorting($table, $row['pid'], $sortRow, $row['uid']); } + } else { + // If after the last record in the list, we just add the sortInterval to the last sortvalue + $sortNumber = $row[$sortRow] + $this->sortIntervals; } - return ['pid' => $row['pid'], 'sortNumber' => $sortNumber]; - } else { - if ($this->enableLogging) { - $propArr = $this->getRecordProperties($table, $uid); - // OK, don't insert $propArr['event_pid'] here... - $this->log($table, $uid, 4, 0, 1, 'Attempt to move record \'%s\' (%s) to after a non-existing record (uid=%s)', 1, [$propArr['header'], $table . ':' . $uid, abs($pid)], $propArr['pid']); - } - // There MUST be a page or else this cannot work - return false; } + return ['pid' => $row['pid'], 'sortNumber' => $sortNumber]; } + if ($this->enableLogging) { + $propArr = $this->getRecordProperties($table, $uid); + // OK, don't insert $propArr['event_pid'] here... + $this->log($table, $uid, 4, 0, 1, 'Attempt to move record \'%s\' (%s) to after a non-existing record (uid=%s)', 1, [$propArr['header'], $table . ':' . $uid, abs($pid)], $propArr['pid']); + } + // There MUST be a page or else this cannot work + return false; } return null; } @@ -7810,9 +7806,8 @@ class DataHandler // Returns the proper delete-clause if any for a table from TCA if (!$this->disableDeleteClause && $GLOBALS['TCA'][$table]['ctrl']['delete']) { return ' AND ' . $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'] . '=0'; - } else { - return ''; } + return ''; } /** @@ -8132,13 +8127,13 @@ class DataHandler if ($conf['foreign_field']) { // The reference to the parent is stored in a pointer field in the child record return 'field'; - } elseif ($conf['MM']) { + } + if ($conf['MM']) { // Regular MM intermediate table is used to store data return 'mm'; - } else { - // An item list (separated by comma) is stored (like select type is doing) - return 'list'; } + // An item list (separated by comma) is stored (like select type is doing) + return 'list'; } /** @@ -8314,7 +8309,8 @@ class DataHandler // If the record was copied: if (isset($this->copyMappingArray[$table][$uid])) { return true; - } elseif (isset($this->copyMappingArray[$table]) && in_array($uid, array_values($this->copyMappingArray[$table]))) { + } + if (isset($this->copyMappingArray[$table]) && in_array($uid, array_values($this->copyMappingArray[$table]))) { return true; } return false; diff --git a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapItem.php b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapItem.php index b1fea7377b57cc73c043afe8f303cc103add7497..4cf0e7ab838e9de664d6b03835797da4b1e68491 100644 --- a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapItem.php +++ b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapItem.php @@ -434,13 +434,13 @@ class DataMapItem { if (MathUtility::canBeInterpretedAsInteger($idValue)) { return $idValue; - } elseif (strpos($idValue, 'NEW') === 0) { + } + if (strpos($idValue, 'NEW') === 0) { return $idValue; - } else { - // @todo Handle if $tableName does not match $this->tableName - list($tableName, $id) = BackendUtility::splitTable_Uid($idValue); - return $id; } + // @todo Handle if $tableName does not match $this->tableName + list($tableName, $id) = BackendUtility::splitTable_Uid($idValue); + return $id; } /** diff --git a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php index a44bc2e0b590ae30f37a3003cd9538628e0b23bf..4f5daa40f5c1fd7b9f5e1d7bd8d803c4d1a8d435 100644 --- a/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php +++ b/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php @@ -1156,7 +1156,8 @@ class DataMapProcessor && $element[$fieldNames['source']] !== $element[$fieldNames['parent']] ) { return (int)$fieldNames['source']; - } elseif (!empty($fieldNames['parent'])) { + } + if (!empty($fieldNames['parent'])) { // implicit: use parent pointer if defined return (int)$element[$fieldNames['parent']]; } diff --git a/typo3/sysext/core/Classes/Database/Query/QueryHelper.php b/typo3/sysext/core/Classes/Database/Query/QueryHelper.php index bb18eb4a0b7c15d259c642a4b10c59035c4c8b3e..069a5a57555687690cb69e4853bc44d00a1e6391 100644 --- a/typo3/sysext/core/Classes/Database/Query/QueryHelper.php +++ b/typo3/sysext/core/Classes/Database/Query/QueryHelper.php @@ -76,11 +76,11 @@ class QueryHelper if (!empty($as) && strtolower($as) === 'as' && !empty($alias)) { return [$tableName, $alias]; - } elseif (!empty($as) && empty($alias)) { + } + if (!empty($as) && empty($alias)) { return [$tableName, $as]; - } else { - return [$tableName, null]; } + return [$tableName, null]; }, $tableExpressions ); diff --git a/typo3/sysext/core/Classes/Database/ReferenceIndex.php b/typo3/sysext/core/Classes/Database/ReferenceIndex.php index 6f115ef4a5c77b2b98a3cb288f4d4fefccb2a545..39c5a683664f5415c7e2f1667171b5a7d41036c3 100644 --- a/typo3/sysext/core/Classes/Database/ReferenceIndex.php +++ b/typo3/sysext/core/Classes/Database/ReferenceIndex.php @@ -899,13 +899,15 @@ class ReferenceIndex // Get IRRE relations if (empty($conf)) { return false; - } elseif ($conf['type'] === 'inline' && !empty($conf['foreign_table']) && empty($conf['MM'])) { + } + if ($conf['type'] === 'inline' && !empty($conf['foreign_table']) && empty($conf['MM'])) { $dbAnalysis = GeneralUtility::makeInstance(RelationHandler::class); $dbAnalysis->setUseLiveReferenceIds(false); $dbAnalysis->start($value, $conf['foreign_table'], '', $uid, $table, $conf); return $dbAnalysis->itemArray; // DB record lists: - } elseif ($this->isDbReferenceField($conf)) { + } + if ($this->isDbReferenceField($conf)) { $allowedTables = $conf['type'] === 'group' ? $conf['allowed'] : $conf['foreign_table']; if ($conf['MM_opposite_field']) { return []; @@ -1042,21 +1044,20 @@ class ReferenceIndex // Data Array, now ready to be sent to DataHandler if ($returnDataArray) { return $dataArray; - } else { - // Execute CMD array: - $dataHandler = GeneralUtility::makeInstance(DataHandler::class); - $dataHandler->dontProcessTransformations = true; - $dataHandler->bypassWorkspaceRestrictions = true; - $dataHandler->bypassFileHandling = true; - // Otherwise this cannot update things in deleted records... - $dataHandler->bypassAccessCheckForRecords = true; - // Check has been done previously that there is a backend user which is Admin and also in live workspace - $dataHandler->start($dataArray, []); - $dataHandler->process_datamap(); - // Return errors if any: - if (!empty($dataHandler->errorLog)) { - return LF . 'DataHandler:' . implode((LF . 'DataHandler:'), $dataHandler->errorLog); - } + } + // Execute CMD array: + $dataHandler = GeneralUtility::makeInstance(DataHandler::class); + $dataHandler->dontProcessTransformations = true; + $dataHandler->bypassWorkspaceRestrictions = true; + $dataHandler->bypassFileHandling = true; + // Otherwise this cannot update things in deleted records... + $dataHandler->bypassAccessCheckForRecords = true; + // Check has been done previously that there is a backend user which is Admin and also in live workspace + $dataHandler->start($dataArray, []); + $dataHandler->process_datamap(); + // Return errors if any: + if (!empty($dataHandler->errorLog)) { + return LF . 'DataHandler:' . implode((LF . 'DataHandler:'), $dataHandler->errorLog); } } } diff --git a/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php b/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php index 1221e471f3cef412a4fc23b5746bd9d3a3a63da5..226d81b3feda6855ac459a4dd6ee5b13bf51ddc4 100644 --- a/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php +++ b/typo3/sysext/core/Classes/Database/Schema/ConnectionMigrator.php @@ -155,15 +155,14 @@ class ConnectionMigrator $this->getChangedFieldUpdateSuggestions($schemaDiff), $this->getChangedTableOptions($schemaDiff) ); - } else { - return array_merge_recursive( + } + return array_merge_recursive( ['change' => [], 'change_table' => [], 'drop' => [], 'drop_table' => [], 'tables_count' => []], $this->getUnusedFieldUpdateSuggestions($schemaDiff), $this->getUnusedTableUpdateSuggestions($schemaDiff), $this->getDropTableUpdateSuggestions($schemaDiff), $this->getDropFieldUpdateSuggestions($schemaDiff) ); - } } /** @@ -1071,9 +1070,8 @@ class ConnectionMigrator if (is_string($nameLengthRestrictions)) { return $this->getTableAndFieldNameMaxLengths($nameLengthRestrictions); - } else { - return $nameLengthRestrictions; } + return $nameLengthRestrictions; } /** diff --git a/typo3/sysext/core/Classes/Error/ErrorHandler.php b/typo3/sysext/core/Classes/Error/ErrorHandler.php index 6cfdcb92290fe6dccf9ca2c3ad7b4fac3b88524c..bdb94c190ffccbca2bb7348b5565ae69dbb7858c 100644 --- a/typo3/sysext/core/Classes/Error/ErrorHandler.php +++ b/typo3/sysext/core/Classes/Error/ErrorHandler.php @@ -110,8 +110,8 @@ class ErrorHandler implements ErrorHandlerInterface die($message); } throw new Exception($message, 1476107295); - } else { - switch ($errorLevel) { + } + switch ($errorLevel) { case E_USER_ERROR: case E_RECOVERABLE_ERROR: $severity = 2; @@ -123,51 +123,49 @@ class ErrorHandler implements ErrorHandlerInterface default: $severity = 0; } - $logTitle = 'Core: Error handler (' . TYPO3_MODE . ')'; - $message = $logTitle . ': ' . $message; - // Write error message to the configured syslogs, - // see: $TYPO3_CONF_VARS['SYS']['systemLog'] - if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['syslogErrorReporting']) { - GeneralUtility::sysLog($message, 'core', $severity + 1); - } - // Write error message to devlog extension(s), - GeneralUtility::devLog($message, 'core', $severity + 1); + $logTitle = 'Core: Error handler (' . TYPO3_MODE . ')'; + $message = $logTitle . ': ' . $message; + // Write error message to the configured syslogs, + // see: $TYPO3_CONF_VARS['SYS']['systemLog'] + if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['syslogErrorReporting']) { + GeneralUtility::sysLog($message, 'core', $severity + 1); + } + // Write error message to devlog extension(s), + GeneralUtility::devLog($message, 'core', $severity + 1); - // Write error message to TSlog (admin panel) - $timeTracker = $this->getTimeTracker(); - if (is_object($timeTracker)) { - $timeTracker->setTSlogMessage($message, $severity + 1); - } - // Write error message to sys_log table (ext: belog, Tools->Log) - if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['belogErrorReporting']) { - // Silently catch in case an error occurs before a database connection exists. - try { - $this->writeLog($message, $severity); - } catch (\Exception $e) { - } + // Write error message to TSlog (admin panel) + $timeTracker = $this->getTimeTracker(); + if (is_object($timeTracker)) { + $timeTracker->setTSlogMessage($message, $severity + 1); + } + // Write error message to sys_log table (ext: belog, Tools->Log) + if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['belogErrorReporting']) { + // Silently catch in case an error occurs before a database connection exists. + try { + $this->writeLog($message, $severity); + } catch (\Exception $e) { } - if ($severity === 2) { - // Let the internal handler continue. This will stop the script - return false; - } else { - if ($this->debugMode) { - /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */ - $flashMessage = GeneralUtility::makeInstance( + } + if ($severity === 2) { + // Let the internal handler continue. This will stop the script + return false; + } + if ($this->debugMode) { + /** @var $flashMessage \TYPO3\CMS\Core\Messaging\FlashMessage */ + $flashMessage = GeneralUtility::makeInstance( \TYPO3\CMS\Core\Messaging\FlashMessage::class, $message, 'PHP ' . $errorLevels[$errorLevel], $severity ); - /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ - $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); - /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ - $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); - $defaultFlashMessageQueue->enqueue($flashMessage); - } - // Don't execute PHP internal error handler - return true; - } + /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ + $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); + /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ + $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); + $defaultFlashMessageQueue->enqueue($flashMessage); } + // Don't execute PHP internal error handler + return true; } /** diff --git a/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php b/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php index 023ca889430f69c71938b9ace1739e7fe26f430c..3b3522d6a14e2e009d475ffdfb3e05af1c5f18e5 100644 --- a/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php +++ b/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php @@ -115,9 +115,8 @@ class ProductionExceptionHandler extends AbstractExceptionHandler { if ($this->discloseExceptionInformation($exception) && method_exists($exception, 'getTitle') && $exception->getTitle() !== '') { return $exception->getTitle(); - } else { - return $this->defaultTitle; } + return $this->defaultTitle; } /** @@ -130,8 +129,7 @@ class ProductionExceptionHandler extends AbstractExceptionHandler { if ($this->discloseExceptionInformation($exception)) { return $exception->getMessage(); - } else { - return $this->defaultMessage; } + return $this->defaultMessage; } } diff --git a/typo3/sysext/core/Classes/ExtDirect/ExtDirectApi.php b/typo3/sysext/core/Classes/ExtDirect/ExtDirectApi.php index b3babf07e73b6f239b86ef244b712decfcc784db..65a155e1f23ed0cf5e486eccc7298302f6afa868 100644 --- a/typo3/sysext/core/Classes/ExtDirect/ExtDirectApi.php +++ b/typo3/sysext/core/Classes/ExtDirect/ExtDirectApi.php @@ -78,10 +78,9 @@ class ExtDirectApi } Ext.apply(Ext.app.ExtDirectAPI, ' . json_encode($javascriptNamespaces) . '); '; - } else { - $errorMessage = $this->getNamespaceError($filterNamespaces); - throw new \InvalidArgumentException($errorMessage, 1297645190); } + $errorMessage = $this->getNamespaceError($filterNamespaces); + throw new \InvalidArgumentException($errorMessage, 1297645190); } /** diff --git a/typo3/sysext/core/Classes/Http/Message.php b/typo3/sysext/core/Classes/Http/Message.php index 1d114b448d39f7d791818afbce65e7597b56119d..02bee07b0fc2f0dbf291c1fa2b81200621ca498f 100644 --- a/typo3/sysext/core/Classes/Http/Message.php +++ b/typo3/sysext/core/Classes/Http/Message.php @@ -151,9 +151,8 @@ class Message implements MessageInterface $headerValue = $this->headers[$header]; if (is_array($headerValue)) { return $headerValue; - } else { - return [$headerValue]; } + return [$headerValue]; } /** diff --git a/typo3/sysext/core/Classes/Http/ServerRequest.php b/typo3/sysext/core/Classes/Http/ServerRequest.php index 9036120da6b0af3fe4306727d3783998f6688f3a..a1dda687b9b495183a34e2bbec8a4d1b7e80a548 100644 --- a/typo3/sysext/core/Classes/Http/ServerRequest.php +++ b/typo3/sysext/core/Classes/Http/ServerRequest.php @@ -356,10 +356,9 @@ class ServerRequest extends Request implements ServerRequestInterface $clonedObject = clone $this; if (!isset($clonedObject->attributes[$name])) { return $clonedObject; - } else { - unset($clonedObject->attributes[$name]); - return $clonedObject; } + unset($clonedObject->attributes[$name]); + return $clonedObject; } /** diff --git a/typo3/sysext/core/Classes/Http/ServerRequestFactory.php b/typo3/sysext/core/Classes/Http/ServerRequestFactory.php index ecef07792c5739fdd80fd3555c9f1c7d2b3e9417..7b7e9e64140eb8d86696cd3208f608e4d055a09d 100644 --- a/typo3/sysext/core/Classes/Http/ServerRequestFactory.php +++ b/typo3/sysext/core/Classes/Http/ServerRequestFactory.php @@ -157,7 +157,8 @@ class ServerRequestFactory } } return $files; - } elseif (!empty($value['tmp_name'])) { + } + if (!empty($value['tmp_name'])) { return new UploadedFile($value['tmp_name'], $value['size'], $value['error'], $value['name'], $value['type']); } return null; diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php index bf8cdb9e7be89dc1a38b81090135d472b8e8c4c2..253646b99feb2870558708689874cc6ca68968a0 100644 --- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php +++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php @@ -928,25 +928,23 @@ class GraphicalFunctions // If any kind of spacing applys, we use this function: if ($spacing || $wordSpacing) { return $conf['fontSize']; - } else { - do { - // Determine bounding box. - $bounds = $this->ImageTTFBBoxWrapper($conf['fontSize'], $conf['angle'], $conf['fontFile'], $conf['text'], $conf['splitRendering.']); - if ($conf['angle'] < 0) { - $pixelWidth = abs($bounds[4] - $bounds[0]); - } elseif ($conf['angle'] > 0) { - $pixelWidth = abs($bounds[2] - $bounds[6]); - } else { - $pixelWidth = abs($bounds[4] - $bounds[6]); - } - // Size is fine, exit: - if ($pixelWidth <= $maxWidth) { - break; - } else { - $conf['fontSize']--; - } - } while ($conf['fontSize'] > 1); } + do { + // Determine bounding box. + $bounds = $this->ImageTTFBBoxWrapper($conf['fontSize'], $conf['angle'], $conf['fontFile'], $conf['text'], $conf['splitRendering.']); + if ($conf['angle'] < 0) { + $pixelWidth = abs($bounds[4] - $bounds[0]); + } elseif ($conf['angle'] > 0) { + $pixelWidth = abs($bounds[2] - $bounds[6]); + } else { + $pixelWidth = abs($bounds[4] - $bounds[6]); + } + // Size is fine, exit: + if ($pixelWidth <= $maxWidth) { + break; + } + $conf['fontSize']--; + } while ($conf['fontSize'] > 1); } return $conf['fontSize']; } @@ -2205,16 +2203,15 @@ class GraphicalFunctions if (file_exists($imageFile) && GeneralUtility::inList($this->imageFileExt, strtolower($reg[0]))) { if ($returnArr = $this->getCachedImageDimensions($imageFile)) { return $returnArr; + } + if ($temp = @getimagesize($imageFile)) { + $returnArr = [$temp[0], $temp[1], strtolower($reg[0]), $imageFile]; } else { - if ($temp = @getimagesize($imageFile)) { - $returnArr = [$temp[0], $temp[1], strtolower($reg[0]), $imageFile]; - } else { - $returnArr = $this->imageMagickIdentify($imageFile); - } - if ($returnArr) { - $this->cacheImageDimensions($returnArr); - return $returnArr; - } + $returnArr = $this->imageMagickIdentify($imageFile); + } + if ($returnArr) { + $this->cacheImageDimensions($returnArr); + return $returnArr; } } return null; @@ -2668,9 +2665,8 @@ class GraphicalFunctions { if ($type === 'ai' || $w * $h < $this->pixelLimitGif) { return $this->gifExtension; - } else { - return 'jpg'; } + return 'jpg'; } /** diff --git a/typo3/sysext/core/Classes/Imaging/IconRegistry.php b/typo3/sysext/core/Classes/Imaging/IconRegistry.php index 5e617688b1b4e3defaf2fa44b2ed953a4032fad7..d3d4a8abd1dc610a7dcafdc86d9b820f3f60156c 100644 --- a/typo3/sysext/core/Classes/Imaging/IconRegistry.php +++ b/typo3/sysext/core/Classes/Imaging/IconRegistry.php @@ -3467,8 +3467,7 @@ class IconRegistry implements SingletonInterface { if (StringUtility::endsWith(strtolower($iconReference), 'svg')) { return SvgIconProvider::class; - } else { - return BitmapIconProvider::class; } + return BitmapIconProvider::class; } } diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php index 7b96db8fa97a7a53e7ea842a1509cfea755f8182..df6e16cb9efd0fa6ce01fcc06e027aa20547970b 100644 --- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php +++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php @@ -179,8 +179,7 @@ class Area { if ($this->isEmpty()) { return ''; - } else { - return json_encode($this->asArray()); } + return json_encode($this->asArray()); } } diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php index 949dde54f60f20468b3fd1eaa3775c173560d225..10a3cf9ee93dcf4a1fefa1cbb2f0adb5a219c76f 100644 --- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php +++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php @@ -129,9 +129,8 @@ class CropVariantCollection { if (isset($this->cropVariants[$id])) { return $this->cropVariants[$id]->getCropArea(); - } else { - return Area::createEmpty(); } + return Area::createEmpty(); } /** @@ -142,9 +141,8 @@ class CropVariantCollection { if (isset($this->cropVariants[$id]) && $this->cropVariants[$id]->getFocusArea() !== null) { return $this->cropVariants[$id]->getFocusArea(); - } else { - return Area::createEmpty(); } + return Area::createEmpty(); } /** diff --git a/typo3/sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php b/typo3/sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php index 890fd7c641a77b4554af40d3940328813b09f532..d61ceed537b78eb6897f0e4c627f11b10e08d8fc 100644 --- a/typo3/sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php +++ b/typo3/sysext/core/Classes/Integrity/DatabaseIntegrityCheck.php @@ -276,9 +276,8 @@ class DatabaseIntegrityCheck ->getConnectionForTable($table) ->update($table, $updateFields, ['uid' => (int)$uid]); return true; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/core/Classes/LinkHandling/LinkService.php b/typo3/sysext/core/Classes/LinkHandling/LinkService.php index 5a525e0f4d970f448b0ace5d1fde16a2660ca063..4c67cffe603454cb8bf73835680949cd0075fd58 100644 --- a/typo3/sysext/core/Classes/LinkHandling/LinkService.php +++ b/typo3/sysext/core/Classes/LinkHandling/LinkService.php @@ -146,7 +146,8 @@ class LinkService implements SingletonInterface { if (is_object($this->handlers[$parameters['type']])) { return $this->handlers[$parameters['type']]->asString($parameters); - } elseif (isset($parameters['url']) && !empty($parameters['url'])) { + } + if (isset($parameters['url']) && !empty($parameters['url'])) { // This usually happens for tel: or other types where a URL is available and the // legacy link service could resolve at least something return $parameters['url']; diff --git a/typo3/sysext/core/Classes/Localization/LanguageService.php b/typo3/sysext/core/Classes/Localization/LanguageService.php index 8865e4049e49535a1f7fab0ad76879bec0db8d7b..2f28450c88fe7c8ead306f364a5dce0799a10d0b 100644 --- a/typo3/sysext/core/Classes/Localization/LanguageService.php +++ b/typo3/sysext/core/Classes/Localization/LanguageService.php @@ -288,10 +288,9 @@ class LanguageService // Return value if not global is set. if (!$setGlobal) { return $globalLanguage; - } else { - $GLOBALS['LOCAL_LANG'] = $globalLanguage; - return null; } + $GLOBALS['LOCAL_LANG'] = $globalLanguage; + return null; } /** diff --git a/typo3/sysext/core/Classes/Localization/LanguageStore.php b/typo3/sysext/core/Classes/Localization/LanguageStore.php index 728e4f1c6114e02f9f955e47bfb6224b28525955..f3f0a84d2b48bca6d6f90e846db462e9af359003 100644 --- a/typo3/sysext/core/Classes/Localization/LanguageStore.php +++ b/typo3/sysext/core/Classes/Localization/LanguageStore.php @@ -199,9 +199,8 @@ class LanguageStore implements \TYPO3\CMS\Core\SingletonInterface { if (isset($this->configuration[$fileReference]['parserClass']) && trim($this->configuration[$fileReference]['parserClass']) !== '') { return GeneralUtility::makeInstance((string)$this->configuration[$fileReference]['parserClass']); - } else { - throw new InvalidParserException(sprintf('Invalid parser configuration for the current file (%s)', $fileReference), 1307293692); } + throw new InvalidParserException(sprintf('Invalid parser configuration for the current file (%s)', $fileReference), 1307293692); } /** @@ -215,9 +214,8 @@ class LanguageStore implements \TYPO3\CMS\Core\SingletonInterface { if (isset($this->configuration[$fileReference]['fileReference']) && trim($this->configuration[$fileReference]['fileReference']) !== '') { return (string)$this->configuration[$fileReference]['fileReference']; - } else { - throw new \InvalidArgumentException(sprintf('Invalid file reference configuration for the current file (%s)', $fileReference), 1307293693); } + throw new \InvalidArgumentException(sprintf('Invalid file reference configuration for the current file (%s)', $fileReference), 1307293693); } /** diff --git a/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php b/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php index 56d77880f37b598c9a88169ac705f3019e8260dd..ae3d9be1d8bc31d779a756feae39db677c13d683 100644 --- a/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php +++ b/typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php @@ -255,11 +255,11 @@ class Rfc822AddressesParser if ($is_group && $address[0] === ',') { $address = trim(substr($address, 1)); return $address; - } elseif ($address !== '') { + } + if ($address !== '') { return $address; - } else { - return ''; } + return ''; } /** @@ -280,9 +280,8 @@ class Rfc822AddressesParser if (count(($parts = explode(':', $string))) > 1) { $string2 = $this->_splitCheck($parts, ':'); return $string2 !== $string; - } else { - return false; } + return false; } /** @@ -361,9 +360,8 @@ class Rfc822AddressesParser if ($num_angle_start < $num_angle_end) { $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; return false; - } else { - return $num_angle_start > $num_angle_end; } + return $num_angle_start > $num_angle_end; } /** diff --git a/typo3/sysext/core/Classes/Migrations/TcaMigration.php b/typo3/sysext/core/Classes/Migrations/TcaMigration.php index 093819d2deb1887f08ca425e680839fde37105d4..e5def1ff925237f7731d86252de8455de4e60a8c 100644 --- a/typo3/sysext/core/Classes/Migrations/TcaMigration.php +++ b/typo3/sysext/core/Classes/Migrations/TcaMigration.php @@ -1843,7 +1843,8 @@ class TcaMigration . $table . '[\'columns\'][\'' . $fieldName . '\'] has been dropped, the setting' . ' is no longer supported'; continue; - } elseif ($defaultExtrasSetting === 'nowrap') { + } + if ($defaultExtrasSetting === 'nowrap') { $fieldConfig['config']['wrap'] = 'off'; $this->messages[] = 'The defaultExtras setting \'nowrap\' in TCA table ' . $table . '[\'columns\'][\'' . $fieldName . '\'] has been migrated to TCA table ' @@ -1881,7 +1882,8 @@ class TcaMigration . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']' . ' has been dropped, the setting is no longer supported'; continue; - } elseif ($defaultExtrasSetting === 'nowrap') { + } + if ($defaultExtrasSetting === 'nowrap') { $overrideConfig['config']['wrap'] = 'off'; $this->messages[] = 'The defaultExtras setting \'nowrap\' in TCA table ' . $table . '[\'types\'][\'' . $typeName . '\'][\'columnsOverrides\'][\'' . $fieldName . '\']' diff --git a/typo3/sysext/core/Classes/Package/PackageManager.php b/typo3/sysext/core/Classes/Package/PackageManager.php index 7d59e6c3bdd3d632259c871ab160a324fa08be2f..b35fd982a2439030fa3d902bf41d97cdbe770763 100644 --- a/typo3/sysext/core/Classes/Package/PackageManager.php +++ b/typo3/sysext/core/Classes/Package/PackageManager.php @@ -482,9 +482,8 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface $lowercasedComposerName = strtolower($composerName); if (isset($this->composerNameToPackageKeyMap[$lowercasedComposerName])) { return $this->composerNameToPackageKeyMap[$lowercasedComposerName]; - } else { - return $composerName; } + return $composerName; } /** @@ -1023,10 +1022,9 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface if (isset($manifest->type) && substr($manifest->type, 0, 10) === 'typo3-cms-') { $packageKey = basename($packagePath); return preg_replace('/[^A-Za-z0-9._-]/', '', $packageKey); - } else { - $packageKey = str_replace('/', '.', $manifest->name); - return preg_replace('/[^A-Za-z0-9.]/', '', $packageKey); } + $packageKey = str_replace('/', '.', $manifest->name); + return preg_replace('/[^A-Za-z0-9.]/', '', $packageKey); } /** diff --git a/typo3/sysext/core/Classes/Resource/AbstractFile.php b/typo3/sysext/core/Classes/Resource/AbstractFile.php index 48694b581a472bdc65aac9e0c1f1f5761c77f68a..4145b75485482796bfc22eb97ba6a54e705c25d6 100644 --- a/typo3/sysext/core/Classes/Resource/AbstractFile.php +++ b/typo3/sysext/core/Classes/Resource/AbstractFile.php @@ -122,9 +122,8 @@ abstract class AbstractFile implements FileInterface { if ($this->hasProperty($key)) { return $this->properties[$key]; - } else { - return null; } + return null; } /** @@ -537,9 +536,8 @@ abstract class AbstractFile implements FileInterface { if ($this->deleted) { return null; - } else { - return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } + return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } /** diff --git a/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php b/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php index 3b06105d17f1f57e1b8b4bb9d325bf143bf40b05..9dd7a97c79b6afd0cb864770291ca2d499e104a8 100644 --- a/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php @@ -65,7 +65,8 @@ class FileCollectionRegistry implements SingletonInterface // Return immediately without changing configuration if ($this->types[$type] === $className) { return true; - } elseif (!$override) { + } + if (!$override) { throw new \InvalidArgumentException('FileCollections ' . $type . ' is already registered.', 1391295643); } } diff --git a/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php b/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php index 2f77ecbce0c7492302b5dfb560be2523651b75e2..9fd1da0952b1648d5a5e45ccded6112861825ced 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php @@ -68,9 +68,8 @@ class DriverRegistry implements \TYPO3\CMS\Core\SingletonInterface // Return immediately without changing configuration if ($this->drivers[$shortName] === $className) { return true; - } else { - throw new \InvalidArgumentException('Driver ' . $shortName . ' is already registered.', 1314979451); } + throw new \InvalidArgumentException('Driver ' . $shortName . ' is already registered.', 1314979451); } $this->drivers[$shortName] = $className; $this->driverConfigurations[$shortName] = [ diff --git a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php index b4536161bd17685a030f382a1e1278948a534db3..56b0654d8dd0af18b2c13e55f89bcbb5115e362b 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php +++ b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php @@ -410,7 +410,8 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver // If calling the method succeeded and thus we can't use that as a return value. if ($result === -1) { return false; - } elseif ($result === false) { + } + if ($result === false) { throw new \RuntimeException( 'Could not apply file/folder name filter ' . $filter[0] . '::' . $filter[1], 1476046425 @@ -1239,9 +1240,8 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver { if ($writable === false) { return $this->getAbsolutePath($fileIdentifier); - } else { - return $this->copyFileToTemporaryPath($fileIdentifier); } + return $this->copyFileToTemporaryPath($fileIdentifier); } /** @@ -1413,11 +1413,11 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver $recycleDirectory = $searchDirectory . '/' . $recyclerSubdirectory; if (is_dir($recycleDirectory)) { return $recycleDirectory; - } elseif ($searchDirectory === $rootDirectory) { + } + if ($searchDirectory === $rootDirectory) { return ''; - } else { - $searchDirectory = PathUtility::dirname($searchDirectory); } + $searchDirectory = PathUtility::dirname($searchDirectory); } return ''; diff --git a/typo3/sysext/core/Classes/Resource/File.php b/typo3/sysext/core/Classes/Resource/File.php index c6339bef79dfc85e8a367fc40d6fff93f3be0100..3af1e4d81a251e85ad78b90cf30e76f22f370fa4 100644 --- a/typo3/sysext/core/Classes/Resource/File.php +++ b/typo3/sysext/core/Classes/Resource/File.php @@ -79,10 +79,9 @@ class File extends AbstractFile { if (parent::hasProperty($key)) { return parent::getProperty($key); - } else { - $metaData = $this->_getMetaData(); - return isset($metaData[$key]) ? $metaData[$key] : null; } + $metaData = $this->_getMetaData(); + return isset($metaData[$key]) ? $metaData[$key] : null; } /** @@ -366,9 +365,8 @@ class File extends AbstractFile { if ($this->isMissing() || $this->deleted) { return false; - } else { - return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } + return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } /** diff --git a/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php b/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php index ada1f77cd439258363db138868086fbb99c6b828..54ad8569777a1f61221d9f68ce3c4b11310fbfe3 100644 --- a/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php +++ b/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php @@ -46,9 +46,8 @@ class FileNameFilter // Only apply the filter if you want to hide the hidden files if (self::$showHiddenFilesAndFolders === false && strpos($itemIdentifier, '/.') !== false) { return -1; - } else { - return true; } + return true; } /** diff --git a/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php b/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php index 4bff3515d269bc1e05466f16ea46c49be6bf31a7..41ea48ed37128869c4a11a19e487c41d40d87d17 100644 --- a/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php @@ -55,11 +55,11 @@ class ExtractorRegistry implements SingletonInterface { if (!class_exists($className)) { throw new \InvalidArgumentException('The class "' . $className . '" you are registering is not available', 1422705270); - } elseif (!in_array(ExtractorInterface::class, class_implements($className))) { + } + if (!in_array(ExtractorInterface::class, class_implements($className))) { throw new \InvalidArgumentException('The extractor needs to implement the ExtractorInterface', 1422705271); - } else { - $this->extractors[] = $className; } + $this->extractors[] = $className; } /** diff --git a/typo3/sysext/core/Classes/Resource/ProcessedFile.php b/typo3/sysext/core/Classes/Resource/ProcessedFile.php index 73d1e8f825bf8ceec46d2dda6ed9bd0ca0f32fc9..b5238fa10d6b40631be47360741a8cb3e32f8f09 100644 --- a/typo3/sysext/core/Classes/Resource/ProcessedFile.php +++ b/typo3/sysext/core/Classes/Resource/ProcessedFile.php @@ -316,9 +316,8 @@ class ProcessedFile extends AbstractFile { if ($this->usesOriginalFile()) { return $this->originalFile->getName(); - } else { - return $this->name; } + return $this->name; } /** @@ -450,9 +449,8 @@ class ProcessedFile extends AbstractFile // The uid always (!) has to come from this file and never the original file (see getOriginalFile() to get this) if ($this->isUnchanged() && $key !== 'uid') { return $this->originalFile->getProperty($key); - } else { - return $this->properties[$key]; } + return $this->properties[$key]; } /** @@ -564,10 +562,10 @@ class ProcessedFile extends AbstractFile { if ($this->deleted) { return null; - } elseif ($this->usesOriginalFile()) { + } + if ($this->usesOriginalFile()) { return $this->getOriginalFile()->getPublicUrl($relativeToCurrentScript); - } else { - return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } + return $this->getStorage()->getPublicUrl($this, $relativeToCurrentScript); } } diff --git a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php index 2798fb8bde2817fdf848784ac35fbab4176f2e85..465903d0d1e863c0f972a52a29e9c7cf984f4ed1 100644 --- a/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php +++ b/typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php @@ -128,9 +128,8 @@ class LocalImageProcessor implements ProcessorInterface $task->getTargetFile()->updateProperties($properties); return true; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php b/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php index 61865086f2eee643b2cf1db5d1f7291c04085bea..de5f976e78663c5fc2a1b33517ae38c66c197784 100644 --- a/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php @@ -56,11 +56,11 @@ class RendererRegistry implements \TYPO3\CMS\Core\SingletonInterface { if (!class_exists($className)) { throw new \InvalidArgumentException('The class "' . $className . '" you are trying to register is not available', 1411840171); - } elseif (!in_array(FileRendererInterface::class, class_implements($className), true)) { + } + if (!in_array(FileRendererInterface::class, class_implements($className), true)) { throw new \InvalidArgumentException('The renderer needs to implement the FileRendererInterface', 1411840172); - } else { - $this->classNames[] = $className; } + $this->classNames[] = $className; } /** diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php index e4162dbc1f551d709fdc7baf01a66d24ca9ba38c..8c97941bec8d46b3822e82725de6d6c1cee46470 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php +++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php @@ -470,14 +470,17 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl if (GeneralUtility::isFirstPartOfStr($input, 'file:')) { $input = substr($input, 5); return $this->retrieveFileOrFolderObject($input); - } elseif (MathUtility::canBeInterpretedAsInteger($input)) { + } + if (MathUtility::canBeInterpretedAsInteger($input)) { return $this->getFileObject($input); - } elseif (strpos($input, ':') > 0) { + } + if (strpos($input, ':') > 0) { list($prefix) = explode(':', $input); if (MathUtility::canBeInterpretedAsInteger($prefix)) { // path or folder in a valid storageUID return $this->getObjectFromCombinedIdentifier($input); - } elseif ($prefix === 'EXT') { + } + if ($prefix === 'EXT') { $input = GeneralUtility::getFileAbsFileName($input); if (empty($input)) { return null; @@ -485,21 +488,18 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl $input = PathUtility::getRelativePath(PATH_site, PathUtility::dirname($input)) . PathUtility::basename($input); return $this->getFileObjectFromCombinedIdentifier($input); - } else { - return null; - } - } else { - // this is a backwards-compatible way to access "0-storage" files or folders - // eliminate double slashes, /./ and /../ - $input = PathUtility::getCanonicalPath(ltrim($input, '/')); - if (@is_file(PATH_site . $input)) { - // only the local file - return $this->getFileObjectFromCombinedIdentifier($input); - } else { - // only the local path - return $this->getFolderObjectFromCombinedIdentifier($input); } + return null; + } + // this is a backwards-compatible way to access "0-storage" files or folders + // eliminate double slashes, /./ and /../ + $input = PathUtility::getCanonicalPath(ltrim($input, '/')); + if (@is_file(PATH_site . $input)) { + // only the local file + return $this->getFileObjectFromCombinedIdentifier($input); } + // only the local path + return $this->getFolderObjectFromCombinedIdentifier($input); } /** @@ -558,11 +558,11 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl $storage = $this->getStorageObject($storageId); if ($storage->hasFile($objectIdentifier)) { return $storage->getFile($objectIdentifier); - } elseif ($storage->hasFolder($objectIdentifier)) { + } + if ($storage->hasFolder($objectIdentifier)) { return $storage->getFolder($objectIdentifier); - } else { - throw new Exception\ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780); } + throw new Exception\ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780); } /** diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorage.php b/typo3/sysext/core/Classes/Resource/ResourceStorage.php index 7aa994541f6a1145a1d7fb92a27e0b8bafff697e..4107be4b746627eb6deb5906aae92319edc29ea4 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceStorage.php +++ b/typo3/sysext/core/Classes/Resource/ResourceStorage.php @@ -521,7 +521,8 @@ class ResourceStorage implements ResourceStorageInterface $isWithinFileMount = true; if (!$checkWriteAccess) { break; - } elseif (empty($fileMount['read_only'])) { + } + if (empty($fileMount['read_only'])) { $writableFileMountAvailable = true; break; } @@ -734,15 +735,14 @@ class ResourceStorage implements ResourceStorageInterface } // If no match we return TRUE return true; - } else { - if ($fileExtensionPermissions['allow'] === '*') { - return true; - } - if ($fileExtensionPermissions['deny'] === '*') { - return false; - } + } + if ($fileExtensionPermissions['allow'] === '*') { return true; } + if ($fileExtensionPermissions['deny'] === '*') { + return false; + } + return true; } return $isAllowed; } @@ -761,12 +761,11 @@ class ResourceStorage implements ResourceStorageInterface 'You are not allowed to read folders', 1430657869 ); - } else { - throw new Exception\InsufficientFolderAccessPermissionsException( + } + throw new Exception\InsufficientFolderAccessPermissionsException( 'You are not allowed to access the given folder: "' . $folder->getName() . '"', 1375955684 ); - } } } @@ -1170,7 +1169,8 @@ class ResourceStorage implements ResourceStorageInterface $replaceExisting = false; if ($conflictMode->equals(DuplicationBehavior::CANCEL) && $this->driver->fileExistsInFolder($targetFileName, $targetFolder->getIdentifier())) { throw new Exception\ExistingTargetFileNameException('File "' . $targetFileName . '" already exists in folder ' . $targetFolder->getIdentifier(), 1322121068); - } elseif ($conflictMode->equals(DuplicationBehavior::RENAME)) { + } + if ($conflictMode->equals(DuplicationBehavior::RENAME)) { $targetFileName = $this->getUniqueName($targetFolder, $targetFileName); } elseif ($conflictMode->equals(DuplicationBehavior::REPLACE) && $this->driver->fileExistsInFolder($targetFileName, $targetFolder->getIdentifier())) { $replaceExisting = true; @@ -2405,9 +2405,8 @@ class ResourceStorage implements ResourceStorageInterface if ($respectFileMounts && !empty($this->fileMounts)) { $mount = reset($this->fileMounts); return $mount['folder']; - } else { - return $this->getResourceFactoryInstance()->createFolderObject($this, $this->driver->getRootLevelFolder(), ''); } + return $this->getResourceFactoryInstance()->createFolderObject($this, $this->driver->getRootLevelFolder(), ''); } /** diff --git a/typo3/sysext/core/Classes/Service/DependencyOrderingService.php b/typo3/sysext/core/Classes/Service/DependencyOrderingService.php index df5de9c8ab73b70fc33e91923711ed78a21d9e92..a98f7f2a6c35dd99a1e7796beec38a73843fefc2 100644 --- a/typo3/sysext/core/Classes/Service/DependencyOrderingService.php +++ b/typo3/sysext/core/Classes/Service/DependencyOrderingService.php @@ -240,12 +240,11 @@ class DependencyOrderingService foreach (array_filter($graph[$from]) as $node => $_) { if ($node === $to) { return [$from, $to]; - } else { - $subPath = $this->findPathInGraph($graph, $node, $to); - if (!empty($subPath)) { - array_unshift($subPath, $from); - return $subPath; - } + } + $subPath = $this->findPathInGraph($graph, $node, $to); + if (!empty($subPath)) { + array_unshift($subPath, $from); + return $subPath; } } return []; diff --git a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php index 58d95aa4139258f15d13825e68d9cc9bd50d5801..97e1f64b02dba3039e6e1ab3a83e85e52f34c637 100644 --- a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php @@ -376,16 +376,13 @@ class ExtendedTemplateService extends TemplateService if ((string)$parts[0] !== '' && is_array($theSetup[$parts[0] . '.'])) { if (trim($parts[1]) !== '') { return $this->ext_getSetup($theSetup[$parts[0] . '.'], trim($parts[1])); - } else { - return [$theSetup[$parts[0] . '.'], $theSetup[$parts[0]]]; - } - } else { - if (trim($theKey) !== '') { - return [[], $theSetup[$theKey]]; - } else { - return [$theSetup, '']; } + return [$theSetup[$parts[0] . '.'], $theSetup[$parts[0]]]; } + if (trim($theKey) !== '') { + return [[], $theSetup[$theKey]]; + } + return [$theSetup, '']; } /** @@ -763,9 +760,8 @@ class ExtendedTemplateService extends TemplateService $tsparser->lineNumberOffset = $this->ext_lineNumberOffset + 1; $tsparser->parentObject = $this; return $tsparser->doSyntaxHighlight($all, $lineNumbers ? [$this->ext_lineNumberOffset + 1] : '', $syntaxHLBlockmode); - } else { - return $this->ext_formatTS($all, $lineNumbers, $comments, $crop); } + return $this->ext_formatTS($all, $lineNumbers, $comments, $crop); } /** @@ -785,9 +781,8 @@ class ExtendedTemplateService extends TemplateService $string = GeneralUtility::fixed_lgd_cs(substr($string, 12, -12), ($chars - 3)); $marker = substr(md5($string), 0, 6); return '##' . $marker . '_B##' . $string . '##' . $marker . '_E##'; - } else { - return GeneralUtility::fixed_lgd_cs($string, $chars - 3); } + return GeneralUtility::fixed_lgd_cs($string, $chars - 3); } } return $string; diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php index a5db2e44ee8008b4c74dc628944c032ebd18262f..00c32557b50b53aaae985bf23dc4c39e17f72514 100644 --- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php +++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php @@ -360,7 +360,8 @@ class TypoScriptParser $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': On return to [GLOBAL] scope, the script was short of ' . $this->inBrace . ' end brace(s)', 1); $this->inBrace = 0; return $line; - } elseif ($line[0] !== '}' && $line[0] !== '#' && $line[0] !== '/') { + } + if ($line[0] !== '}' && $line[0] !== '#' && $line[0] !== '/') { // If not brace-end or comment // Find object name string until we meet an operator $varL = strcspn($line, TAB . ' {=<>('); @@ -644,11 +645,11 @@ class TypoScriptParser $retArr[1] = $setup[$subKey]; } return $retArr; - } else { - if ($setup[$subKey]) { - return $this->getVal($remainingKey, $setup[$subKey]); - } } + if ($setup[$subKey]) { + return $this->getVal($remainingKey, $setup[$subKey]); + } + return []; } diff --git a/typo3/sysext/core/Classes/TypoScript/TemplateService.php b/typo3/sysext/core/Classes/TypoScript/TemplateService.php index ac2a98b508a19b27a1f9c9e88c6d4cd12a16dff0..f2a7930b0e45734369fd0a27e8c7d31be8db61dc 100644 --- a/typo3/sysext/core/Classes/TypoScript/TemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/TemplateService.php @@ -1332,7 +1332,8 @@ class TemplateService $file = trim($fileFromSetup); if (!$file) { return null; - } elseif (strpos($file, '../') !== false) { + } + if (strpos($file, '../') !== false) { if ($this->tt_track) { $this->getTimeTracker()->setTSlogMessage('File path "' . $file . '" contained illegal string "../"!', 3); } diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index b4d2624338373932e60f3ea6d131d982dbfc52a6..99e41497faa19d59ae7c9574d0ce058624a33caf 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -279,14 +279,14 @@ class GeneralUtility $list = trim($list); if ($list === '') { return false; - } elseif ($list === '*') { + } + if ($list === '*') { return true; } if (strpos($baseIP, ':') !== false && self::validIPv6($baseIP)) { return self::cmpIPv6($baseIP, $list); - } else { - return self::cmpIPv4($baseIP, $list); } + return self::cmpIPv4($baseIP, $list); } /** @@ -582,9 +582,8 @@ class GeneralUtility if ($wildcardMatched) { // Match found by recursive compare return true; - } else { - $yes = false; } + $yes = false; } } elseif ($baseHostNameParts[$index] !== $val) { // In case of no match @@ -933,13 +932,12 @@ class GeneralUtility { if (isset(self::$idnaStringCache[$value])) { return self::$idnaStringCache[$value]; - } else { - if (!self::$idnaConverter) { - self::$idnaConverter = new \Mso\IdnaConvert\IdnaConvert(['idn_version' => 2008]); - } - self::$idnaStringCache[$value] = self::$idnaConverter->encode($value); - return self::$idnaStringCache[$value]; } + if (!self::$idnaConverter) { + self::$idnaConverter = new \Mso\IdnaConvert\IdnaConvert(['idn_version' => 2008]); + } + self::$idnaStringCache[$value] = self::$idnaConverter->encode($value); + return self::$idnaStringCache[$value]; } /** @@ -1091,16 +1089,15 @@ class GeneralUtility $position = strrpos($string, strrev($delimiter)); if ($position !== false) { return [substr($string, 0, $position), substr($string, $position + strlen($delimiter))]; - } else { - return [$string]; } - } elseif ($count <= 1) { return [$string]; - } else { - $explodedValues = explode($delimiter, strrev($string), $count); - $explodedValues = array_map('strrev', $explodedValues); - return array_reverse($explodedValues); } + if ($count <= 1) { + return [$string]; + } + $explodedValues = explode($delimiter, strrev($string), $count); + $explodedValues = array_map('strrev', $explodedValues); + return array_reverse($explodedValues); } /** @@ -3041,9 +3038,8 @@ class GeneralUtility if ((string)$filename !== '' && static::validPathStr($filename)) { // checks backpath. return $filename; - } else { - return ''; } + return ''; } /** @@ -3736,24 +3732,24 @@ class GeneralUtility // reset service and return object $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset(); return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]; - } else { - $obj = self::makeInstance($info['className']); - if (is_object($obj)) { - if (!@is_callable([$obj, 'init'])) { - // use silent logging??? I don't think so. - die('Broken service:' . DebugUtility::viewArray($info)); - } - $obj->info = $info; - // service available? - if ($obj->init()) { - // create persistent object - $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj; - return $obj; - } - $error = $obj->getLastErrorArray(); - unset($obj); + } + $obj = self::makeInstance($info['className']); + if (is_object($obj)) { + if (!@is_callable([$obj, 'init'])) { + // use silent logging??? I don't think so. + die('Broken service:' . DebugUtility::viewArray($info)); } + $obj->info = $info; + // service available? + if ($obj->init()) { + // create persistent object + $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj; + return $obj; + } + $error = $obj->getLastErrorArray(); + unset($obj); } + // deactivate the service ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']); } diff --git a/typo3/sysext/core/Classes/Utility/MailUtility.php b/typo3/sysext/core/Classes/Utility/MailUtility.php index c564d465593a7c63e0c77040a829e679831a31b7..5d4752401f3fcbeb0ece82e4eaec90e841b2907f 100644 --- a/typo3/sysext/core/Classes/Utility/MailUtility.php +++ b/typo3/sysext/core/Classes/Utility/MailUtility.php @@ -35,11 +35,11 @@ class MailUtility $name = self::getSystemFromName(); if (!$address) { return null; - } elseif ($name) { + } + if ($name) { return [$address => $name]; - } else { - return [$address]; } + return [$address]; } /** @@ -53,9 +53,8 @@ class MailUtility { if ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName']) { return $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName']; - } else { - return null; } + return null; } /** diff --git a/typo3/sysext/core/Classes/Utility/MathUtility.php b/typo3/sysext/core/Classes/Utility/MathUtility.php index 363587655ad2aaf480dda0aeb437d0236bc5df88..51a0b4ae7d1d5fa0f6bcf25483da883267dfe36a 100644 --- a/typo3/sysext/core/Classes/Utility/MathUtility.php +++ b/typo3/sysext/core/Classes/Utility/MathUtility.php @@ -177,9 +177,9 @@ class MathUtility $value = self::calculateWithPriorityToAdditionAndSubtraction(substr($string, 0, $valueLenC)); $string = $value . substr($string, ($valueLenC + 1)); return $string; - } else { - $string = substr($string, 0, $valueLenO) . self::calculateWithParentheses(substr($string, ($valueLenO + 1))); } + $string = substr($string, 0, $valueLenO) . self::calculateWithParentheses(substr($string, ($valueLenO + 1))); + // Security: $securC--; if ($securC <= 0) { diff --git a/typo3/sysext/core/Classes/Utility/RootlineUtility.php b/typo3/sysext/core/Classes/Utility/RootlineUtility.php index a182cb506620d75c3bef57895448b9fca826a6c6..5dba704bc54d4c91605cb11526e8bcf495505c85 100644 --- a/typo3/sysext/core/Classes/Utility/RootlineUtility.php +++ b/typo3/sysext/core/Classes/Utility/RootlineUtility.php @@ -148,9 +148,8 @@ class RootlineUtility if ($this->mountPointParameter !== '') { if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) { throw new \RuntimeException('Mount-Point Pages are disabled for this installation. Cannot resolve a Rootline for a page with Mount-Points', 1343462896); - } else { - $this->parseMountPointParameter(); } + $this->parseMountPointParameter(); } if (self::$cache === null) { self::$cache = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('cache_rootline'); diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php index ee32d0e1464175be2d89f3efc00fa51da4331542..0e37ddc07190d67e21dab4509295170274971840 100644 --- a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/HookTest.php @@ -345,7 +345,8 @@ class HookTest extends AbstractDataHandlerActionTestCase $rightValue = $right[$key] ?? null; if (!is_array($leftValue) && (string)$leftValue !== (string)$rightValue) { return false; - } elseif (is_array($leftValue)) { + } + if (is_array($leftValue)) { if (!$this->equals($leftValue, $rightValue)) { return false; } diff --git a/typo3/sysext/core/Tests/Unit/Configuration/FlexForm/Fixtures/DataStructureParsePreProcessHookReturnString.php b/typo3/sysext/core/Tests/Unit/Configuration/FlexForm/Fixtures/DataStructureParsePreProcessHookReturnString.php index 9e3c6b1c322fbba408f1d071948678498bdc4fdf..d14c00e34f08f0046f849ee9fa36644e3d86386a 100644 --- a/typo3/sysext/core/Tests/Unit/Configuration/FlexForm/Fixtures/DataStructureParsePreProcessHookReturnString.php +++ b/typo3/sysext/core/Tests/Unit/Configuration/FlexForm/Fixtures/DataStructureParsePreProcessHookReturnString.php @@ -34,8 +34,7 @@ class DataStructureParsePreProcessHookReturnString <sheets></sheets> </T3DataStructure> '; - } else { - return ''; } + return ''; } } diff --git a/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/LocalDriverFilenameFilter.php b/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/LocalDriverFilenameFilter.php index 0feedcf1b64caf4c27f81865dd7333930285f1bf..57a1cabdac192c7ab2564b0aad91b9fdd659e4c4 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/LocalDriverFilenameFilter.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Driver/Fixtures/LocalDriverFilenameFilter.php @@ -33,8 +33,7 @@ class LocalDriverFilenameFilter { if ($itemName === 'fileA' || $itemName === 'folderA/') { return -1; - } else { - return true; } + return true; } } diff --git a/typo3/sysext/documentation/Classes/Service/DocumentationService.php b/typo3/sysext/documentation/Classes/Service/DocumentationService.php index 930ca31c55d5b58cab1e58ed4c97c0a65bb76b21..30c9db4c550cfbcf23bb5a2a0a82e84b470ef413 100644 --- a/typo3/sysext/documentation/Classes/Service/DocumentationService.php +++ b/typo3/sysext/documentation/Classes/Service/DocumentationService.php @@ -120,17 +120,17 @@ class DocumentationService $success |= $this->fetchDocument($url, $key, $version, $language); // Fetch next language continue; - } else { - if (isset($packages[$version])) { - foreach ($packages[$version] as $locale => $_) { - if (GeneralUtility::isFirstPartOfStr($locale, $language)) { - $success |= $this->fetchDocument($url, $key, $version, $locale); - // Fetch next language (jump current foreach up to the loop of $languages) - continue 2; - } + } + if (isset($packages[$version])) { + foreach ($packages[$version] as $locale => $_) { + if (GeneralUtility::isFirstPartOfStr($locale, $language)) { + $success |= $this->fetchDocument($url, $key, $version, $locale); + // Fetch next language (jump current foreach up to the loop of $languages) + continue 2; } } } + // Step 2) if (preg_match('/^(\d+\.\d+)\.\d+$/', $version, $matches)) { // Instead of a 3-digit version, try to get it on 2 digits diff --git a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php index e25cd56fd69bfddf98f4862ae72ba42fc5441a55..2ff8abfd1c682ac895b3a19c7b115a255277c5f0 100644 --- a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php +++ b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php @@ -67,9 +67,8 @@ abstract class AbstractDomainObject implements DomainObjectInterface, \TYPO3\CMS { if ($this->uid !== null) { return (int)$this->uid; - } else { - return null; } + return null; } /** @@ -95,9 +94,8 @@ abstract class AbstractDomainObject implements DomainObjectInterface, \TYPO3\CMS { if ($this->pid === null) { return null; - } else { - return (int)$this->pid; } + return (int)$this->pid; } /** diff --git a/typo3/sysext/extbase/Classes/Error/Message.php b/typo3/sysext/extbase/Classes/Error/Message.php index 419fb4d5855eda40902c11980af8492e958e0298..9769ad1e566f0151f6354cc437f587ca166f2492 100644 --- a/typo3/sysext/extbase/Classes/Error/Message.php +++ b/typo3/sysext/extbase/Classes/Error/Message.php @@ -127,9 +127,8 @@ class Message { if (!empty($this->arguments)) { return vsprintf($this->message, $this->arguments); - } else { - return $this->message; } + return $this->message; } /** diff --git a/typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php b/typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php index e2957914e012ff4b3b7df626b2df2e60c61dcf61..e13efb9a3717b954a9d6316b50611f0303ebbe9e 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php +++ b/typo3/sysext/extbase/Classes/Mvc/Controller/Argument.php @@ -293,9 +293,8 @@ class Argument { if ($this->value === null) { return $this->defaultValue; - } else { - return $this->value; } + return $this->value; } /** diff --git a/typo3/sysext/extbase/Classes/Mvc/View/JsonView.php b/typo3/sysext/extbase/Classes/Mvc/View/JsonView.php index 6659fc4391c98d0733f8e999b3208626474365ed..c132eacb9637a4ed18e5c93c25e72bb3d3dfb98c 100644 --- a/typo3/sysext/extbase/Classes/Mvc/View/JsonView.php +++ b/typo3/sysext/extbase/Classes/Mvc/View/JsonView.php @@ -281,11 +281,11 @@ class JsonView extends AbstractView } } return $array; - } elseif (is_object($value)) { + } + if (is_object($value)) { return $this->transformObject($value, $configuration); - } else { - return $value; } + return $value; } /** @@ -300,41 +300,40 @@ class JsonView extends AbstractView { if ($object instanceof \DateTime) { return $object->format(\DateTime::ATOM); - } else { - $propertyNames = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettablePropertyNames($object); + } + $propertyNames = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettablePropertyNames($object); - $propertiesToRender = []; - foreach ($propertyNames as $propertyName) { - if (isset($configuration['_only']) && is_array($configuration['_only']) && !in_array($propertyName, $configuration['_only'])) { - continue; - } - if (isset($configuration['_exclude']) && is_array($configuration['_exclude']) && in_array($propertyName, $configuration['_exclude'])) { - continue; - } + $propertiesToRender = []; + foreach ($propertyNames as $propertyName) { + if (isset($configuration['_only']) && is_array($configuration['_only']) && !in_array($propertyName, $configuration['_only'])) { + continue; + } + if (isset($configuration['_exclude']) && is_array($configuration['_exclude']) && in_array($propertyName, $configuration['_exclude'])) { + continue; + } - $propertyValue = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($object, $propertyName); + $propertyValue = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($object, $propertyName); - if (!is_array($propertyValue) && !is_object($propertyValue)) { - $propertiesToRender[$propertyName] = $propertyValue; - } elseif (isset($configuration['_descend']) && array_key_exists($propertyName, $configuration['_descend'])) { - $propertiesToRender[$propertyName] = $this->transformValue($propertyValue, $configuration['_descend'][$propertyName]); - } + if (!is_array($propertyValue) && !is_object($propertyValue)) { + $propertiesToRender[$propertyName] = $propertyValue; + } elseif (isset($configuration['_descend']) && array_key_exists($propertyName, $configuration['_descend'])) { + $propertiesToRender[$propertyName] = $this->transformValue($propertyValue, $configuration['_descend'][$propertyName]); } - if (isset($configuration['_exposeObjectIdentifier']) && $configuration['_exposeObjectIdentifier'] === true) { - if (isset($configuration['_exposedObjectIdentifierKey']) && strlen($configuration['_exposedObjectIdentifierKey']) > 0) { - $identityKey = $configuration['_exposedObjectIdentifierKey']; - } else { - $identityKey = '__identity'; - } - $propertiesToRender[$identityKey] = $this->persistenceManager->getIdentifierByObject($object); - } - if (isset($configuration['_exposeClassName']) && ($configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED || $configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_UNQUALIFIED)) { - $className = get_class($object); - $classNameParts = explode('\\', $className); - $propertiesToRender['__class'] = ($configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED ? $className : array_pop($classNameParts)); + } + if (isset($configuration['_exposeObjectIdentifier']) && $configuration['_exposeObjectIdentifier'] === true) { + if (isset($configuration['_exposedObjectIdentifierKey']) && strlen($configuration['_exposedObjectIdentifierKey']) > 0) { + $identityKey = $configuration['_exposedObjectIdentifierKey']; + } else { + $identityKey = '__identity'; } - - return $propertiesToRender; + $propertiesToRender[$identityKey] = $this->persistenceManager->getIdentifierByObject($object); } + if (isset($configuration['_exposeClassName']) && ($configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED || $configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_UNQUALIFIED)) { + $className = get_class($object); + $classNameParts = explode('\\', $className); + $propertiesToRender['__class'] = ($configuration['_exposeClassName'] === self::EXPOSE_CLASSNAME_FULLY_QUALIFIED ? $className : array_pop($classNameParts)); + } + + return $propertiesToRender; } } diff --git a/typo3/sysext/extbase/Classes/Mvc/Web/Request.php b/typo3/sysext/extbase/Classes/Mvc/Web/Request.php index 4da614e7d538b5cb704fc5006d3ca8976c1bb42a..cc74137218974527d4db524e7789212f544d8288 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Web/Request.php +++ b/typo3/sysext/extbase/Classes/Mvc/Web/Request.php @@ -151,9 +151,8 @@ class Request extends \TYPO3\CMS\Extbase\Mvc\Request { if ($this->environmentService->isEnvironmentInBackendMode()) { return $this->baseUri . TYPO3_mainDir; - } else { - return $this->baseUri; } + return $this->baseUri; } /** diff --git a/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php b/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php index 24bc638bb7295b20cecdcf9e1f9bf922be43f14a..10cd7c8638694f0299b6edcf829a99dcadc6593f 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php +++ b/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php @@ -208,7 +208,8 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface $configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (isset($configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved']) && (bool)$configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved']) { throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException('The requested resource was not found', 1313857897); - } elseif (isset($configuration['mvc']['callDefaultActionIfActionCantBeResolved']) && (bool)$configuration['mvc']['callDefaultActionIfActionCantBeResolved']) { + } + if (isset($configuration['mvc']['callDefaultActionIfActionCantBeResolved']) && (bool)$configuration['mvc']['callDefaultActionIfActionCantBeResolved']) { return $this->defaultControllerName; } throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidControllerNameException( @@ -246,7 +247,8 @@ class RequestBuilder implements \TYPO3\CMS\Core\SingletonInterface $configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (isset($configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved']) && (bool)$configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved']) { throw new \TYPO3\CMS\Core\Error\Http\PageNotFoundException('The requested resource was not found', 1313857898); - } elseif (isset($configuration['mvc']['callDefaultActionIfActionCantBeResolved']) && (bool)$configuration['mvc']['callDefaultActionIfActionCantBeResolved']) { + } + if (isset($configuration['mvc']['callDefaultActionIfActionCantBeResolved']) && (bool)$configuration['mvc']['callDefaultActionIfActionCantBeResolved']) { return $defaultActionName; } throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException('The action "' . $actionName . '" (controller "' . $controllerName . '") is not allowed by this plugin. Please check TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php.', 1313855175); diff --git a/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php b/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php index 5177f26acebae8738ca03474dff515013a75a16a..f27a50666ee216642a7549cb27bb44ddf2ca11ae 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php +++ b/typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php @@ -622,9 +622,8 @@ class UriBuilder { if ($this->environmentService->isEnvironmentInBackendMode()) { return $this->buildBackendUri(); - } else { - return $this->buildFrontendUri(); } + return $this->buildFrontendUri(); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php index c35e12c539c96df961a9bed27c189caa3d5f667c..c70360260de2da9368be6ae1e15296262b0a613a 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php @@ -283,12 +283,11 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface { if ($this->session->hasIdentifier($identifier, $className)) { return $this->session->getObjectByIdentifier($identifier, $className); - } else { - $query = $this->persistenceManager->createQueryForType($className); - $query->getQuerySettings()->setRespectStoragePage(false); - $query->getQuerySettings()->setRespectSysLanguage(false); - return $query->matching($query->equals('uid', $identifier))->execute()->getFirst(); } + $query = $this->persistenceManager->createQueryForType($className); + $query->getQuerySettings()->setRespectStoragePage(false); + $query->getQuerySettings()->setRespectSysLanguage(false); + return $query->matching($query->equals('uid', $identifier))->execute()->getFirst(); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php index f92d070ed944a5faa4bbd695b73744896dd4278a..b4001c1ea1e2c3531a282c45257153653b362934 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php @@ -86,9 +86,8 @@ class LazyLoadingProxy implements \Iterator, \TYPO3\CMS\Extbase\Persistence\Gene $this->parentObject->_setProperty($this->propertyName, $propertyValue); $this->parentObject->_memorizeCleanState($this->propertyName); return $propertyValue; - } else { - return $this->parentObject->_getProperty($this->propertyName); } + return $this->parentObject->_getProperty($this->propertyName); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php index fb49f9fc17c0b47a568362552b80eeb5b2692214..4adb5bedad8eac2c4c46cbc05644fa0d5350d17a 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php @@ -325,16 +325,16 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface if (empty($value) || $value === '0000-00-00' || $value === '0000-00-00 00:00:00') { // 0 -> NULL !!! return null; - } elseif ($storageFormat === 'date' || $storageFormat === 'datetime') { + } + if ($storageFormat === 'date' || $storageFormat === 'datetime') { // native date/datetime values are stored in UTC $utcTimeZone = new \DateTimeZone('UTC'); $utcDateTime = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, $value, $utcTimeZone); $currentTimeZone = new \DateTimeZone(date_default_timezone_get()); return $utcDateTime->setTimezone($currentTimeZone); - } else { - // integer timestamps are local server time - return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, date('c', $value)); } + // integer timestamps are local server time + return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, date('c', $value)); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php b/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php index 65d46e36622af3308d7ee705ee0b96a791aa8333..29145b79b8cb054f2803b1a682087e12a4ef55c8 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/PersistenceManager.php @@ -160,9 +160,8 @@ class PersistenceManager implements \TYPO3\CMS\Extbase\Persistence\PersistenceMa } if ($this->persistenceSession->hasIdentifier($identifier, $objectType)) { return $this->persistenceSession->getObjectByIdentifier($identifier, $objectType); - } else { - return $this->backend->getObjectByIdentifier($identifier, $objectType); } + return $this->backend->getObjectByIdentifier($identifier, $objectType); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php index c5ff08e0560c8047ade8a0d5ee362f6de320155a..fdf6f1bf66ca7890fe6b775b3fe0ed3c0bcd54bc 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php @@ -207,9 +207,8 @@ class Query implements QueryInterface $source = $this->getSource(); if ($source instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\SelectorInterface) { return $source->getSelectorName(); - } else { - return ''; } + return ''; } /** @@ -236,9 +235,8 @@ class Query implements QueryInterface { if ($returnRawQueryResult) { return $this->persistenceManager->getObjectDataByQuery($this); - } else { - return $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface::class, $this); } + return $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface::class, $this); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php index 9990315bbd2270f9f1bd32f27fb39b0be619707d..66003bb3fa73a14a04e6b1442a2617646c66d917 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php @@ -503,9 +503,8 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface ->fetchColumn(0); if ($uid > 0) { return $uid; - } else { - return false; } + return false; } catch (DBALException $e) { throw new SqlErrorException($e->getPrevious()->getMessage(), 1470231748); } diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php index b54916a338e91892c633e48a14d580690aae3d6f..84b0bbef436d4171f551761f8bd396b5d4fe0c50 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php @@ -198,10 +198,10 @@ class Typo3DbQueryParser $this->parseConstraint($constraint1, $source), $this->parseConstraint($constraint2, $source) ); - } else { - return ''; } - } elseif ($constraint instanceof Qom\OrInterface) { + return ''; + } + if ($constraint instanceof Qom\OrInterface) { $constraint1 = $constraint->getConstraint1(); $constraint2 = $constraint->getConstraint2(); if (($constraint1 instanceof Qom\ConstraintInterface) @@ -211,16 +211,16 @@ class Typo3DbQueryParser $this->parseConstraint($constraint->getConstraint1(), $source), $this->parseConstraint($constraint->getConstraint2(), $source) ); - } else { - return ''; } - } elseif ($constraint instanceof Qom\NotInterface) { + return ''; + } + if ($constraint instanceof Qom\NotInterface) { return ' NOT(' . $this->parseConstraint($constraint->getConstraint(), $source) . ')'; - } elseif ($constraint instanceof Qom\ComparisonInterface) { + } + if ($constraint instanceof Qom\ComparisonInterface) { return $this->parseComparison($constraint, $source); - } else { - throw new \RuntimeException('not implemented', 1476199898); } + throw new \RuntimeException('not implemented', 1476199898); } /** @@ -300,27 +300,27 @@ class Typo3DbQueryParser if ($comparison->getOperator() === QueryInterface::OPERATOR_CONTAINS) { if ($comparison->getOperand2() === null) { throw new Exception\BadConstraintException('The value for the CONTAINS operator must not be null.', 1484828468); - } else { - $value = $this->dataMapper->getPlainValue($comparison->getOperand2()); - if (!$source instanceof Qom\SelectorInterface) { - throw new \RuntimeException('Source is not of type "SelectorInterface"', 1395362539); - } - $className = $source->getNodeTypeName(); - $tableName = $this->dataMapper->convertClassNameToTableName($className); - $operand1 = $comparison->getOperand1(); - $propertyName = $operand1->getPropertyName(); - $fullPropertyPath = ''; - while (strpos($propertyName, '.') !== false) { - $this->addUnionStatement($className, $tableName, $propertyName, $fullPropertyPath); - } - $columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className); - $dataMap = $this->dataMapper->getDataMap($className); - $columnMap = $dataMap->getColumnMap($propertyName); - $typeOfRelation = $columnMap instanceof ColumnMap ? $columnMap->getTypeOfRelation() : null; - if ($typeOfRelation === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) { - $relationTableName = $columnMap->getRelationTableName(); - $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); - $queryBuilderForSubselect + } + $value = $this->dataMapper->getPlainValue($comparison->getOperand2()); + if (!$source instanceof Qom\SelectorInterface) { + throw new \RuntimeException('Source is not of type "SelectorInterface"', 1395362539); + } + $className = $source->getNodeTypeName(); + $tableName = $this->dataMapper->convertClassNameToTableName($className); + $operand1 = $comparison->getOperand1(); + $propertyName = $operand1->getPropertyName(); + $fullPropertyPath = ''; + while (strpos($propertyName, '.') !== false) { + $this->addUnionStatement($className, $tableName, $propertyName, $fullPropertyPath); + } + $columnName = $this->dataMapper->convertPropertyNameToColumnName($propertyName, $className); + $dataMap = $this->dataMapper->getDataMap($className); + $columnMap = $dataMap->getColumnMap($propertyName); + $typeOfRelation = $columnMap instanceof ColumnMap ? $columnMap->getTypeOfRelation() : null; + if ($typeOfRelation === ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) { + $relationTableName = $columnMap->getRelationTableName(); + $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); + $queryBuilderForSubselect ->select($columnMap->getParentKeyFieldName()) ->from($relationTableName) ->where( @@ -329,24 +329,25 @@ class Typo3DbQueryParser $this->queryBuilder->createNamedParameter($value) ) ); - $additionalWhereForMatchFields = $this->getAdditionalMatchFieldsStatement($queryBuilderForSubselect->expr(), $columnMap, $relationTableName, $relationTableName); - if ($additionalWhereForMatchFields) { - $queryBuilderForSubselect->andWhere($additionalWhereForMatchFields); - } + $additionalWhereForMatchFields = $this->getAdditionalMatchFieldsStatement($queryBuilderForSubselect->expr(), $columnMap, $relationTableName, $relationTableName); + if ($additionalWhereForMatchFields) { + $queryBuilderForSubselect->andWhere($additionalWhereForMatchFields); + } - return $this->queryBuilder->expr()->comparison( + return $this->queryBuilder->expr()->comparison( $this->queryBuilder->quoteIdentifier($tableName . '.uid'), 'IN', '(' . $queryBuilderForSubselect->getSQL() . ')' ); - } elseif ($typeOfRelation === ColumnMap::RELATION_HAS_MANY) { - $parentKeyFieldName = $columnMap->getParentKeyFieldName(); - if (isset($parentKeyFieldName)) { - $childTableName = $columnMap->getChildTableName(); + } + if ($typeOfRelation === ColumnMap::RELATION_HAS_MANY) { + $parentKeyFieldName = $columnMap->getParentKeyFieldName(); + if (isset($parentKeyFieldName)) { + $childTableName = $columnMap->getChildTableName(); - // Build the SQL statement of the subselect - $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); - $queryBuilderForSubselect + // Build the SQL statement of the subselect + $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); + $queryBuilderForSubselect ->select($parentKeyFieldName) ->from($childTableName) ->where( @@ -356,24 +357,20 @@ class Typo3DbQueryParser ) ); - // Add it to the main query - return $this->queryBuilder->expr()->eq( + // Add it to the main query + return $this->queryBuilder->expr()->eq( $tableName . '.uid', '(' . $queryBuilderForSubselect->getSQL() . ')' ); - } else { - return $this->queryBuilder->expr()->inSet( + } + return $this->queryBuilder->expr()->inSet( $tableName . '.' . $columnName, $this->queryBuilder->quote($value) ); - } - } else { - throw new RepositoryException('Unsupported or non-existing property name "' . $propertyName . '" used in relation matching.', 1327065745); - } } - } else { - return $this->parseDynamicOperand($comparison, $source); + throw new RepositoryException('Unsupported or non-existing property name "' . $propertyName . '" used in relation matching.', 1327065745); } + return $this->parseDynamicOperand($comparison, $source); } /** @@ -605,9 +602,8 @@ class Typo3DbQueryParser if (!empty($additionalWhereForMatchFields)) { return $exprBuilder->andX(...$additionalWhereForMatchFields); - } else { - return ''; } + return ''; } /** @@ -763,9 +759,9 @@ class Typo3DbQueryParser ) ) ); - } else { - $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); - $queryBuilderForSubselect + } + $queryBuilderForSubselect = $this->queryBuilder->getConnection()->createQueryBuilder(); + $queryBuilderForSubselect ->select($tableAlias . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) ->from($tableName) ->where( @@ -774,7 +770,7 @@ class Typo3DbQueryParser $queryBuilderForSubselect->expr()->eq($tableName . '.' . $languageField, (int)$querySettings->getLanguageUid()) ) ); - return $this->queryBuilder->expr()->orX( + return $this->queryBuilder->expr()->orX( $this->queryBuilder->expr()->in($tableAlias . '.' . $languageField, [(int)$querySettings->getLanguageUid(), -1]), $this->queryBuilder->expr()->andX( $this->queryBuilder->expr()->eq($tableAlias . '.' . $languageField, 0), @@ -785,13 +781,11 @@ class Typo3DbQueryParser ) ) ); - } - } else { - return $this->queryBuilder->expr()->in( + } + return $this->queryBuilder->expr()->in( $tableAlias . '.' . $languageField, [(int)$querySettings->getLanguageUid(), -1] ); - } } } return ''; @@ -839,9 +833,8 @@ class Typo3DbQueryParser $storagePageIds = array_map('intval', $storagePageIds); if (count($storagePageIds) === 1) { return $this->queryBuilder->expr()->eq($tableAlias . '.pid', reset($storagePageIds)); - } else { - return $this->queryBuilder->expr()->in($tableAlias . '.pid', $storagePageIds); } + return $this->queryBuilder->expr()->in($tableAlias . '.pid', $storagePageIds); } /** diff --git a/typo3/sysext/extbase/Classes/Persistence/Repository.php b/typo3/sysext/extbase/Classes/Persistence/Repository.php index 9932903b1ec740af5a568fb6e3e364ebf9c6c5c5..d3830d4e93cf44a6bb26c99d793924855883d3c3 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Repository.php +++ b/typo3/sysext/extbase/Classes/Persistence/Repository.php @@ -233,14 +233,16 @@ class Repository implements RepositoryInterface, \TYPO3\CMS\Core\SingletonInterf $query = $this->createQuery(); $result = $query->matching($query->equals($propertyName, $arguments[0]))->execute(); return $result; - } elseif (substr($methodName, 0, 9) === 'findOneBy' && strlen($methodName) > 10) { + } + if (substr($methodName, 0, 9) === 'findOneBy' && strlen($methodName) > 10) { $propertyName = lcfirst(substr($methodName, 9)); $query = $this->createQuery(); $result = $query->matching($query->equals($propertyName, $arguments[0]))->setLimit(1)->execute(); if ($result instanceof QueryResultInterface) { return $result->getFirst(); - } elseif (is_array($result)) { + } + if (is_array($result)) { return isset($result[0]) ? $result[0] : null; } } elseif (substr($methodName, 0, 7) === 'countBy' && strlen($methodName) > 8) { diff --git a/typo3/sysext/extbase/Classes/Property/PropertyMapper.php b/typo3/sysext/extbase/Classes/Property/PropertyMapper.php index 727cf99d5248dde92b12302821cb548c97e933f3..cd98ebe2110e79cbc8b6ee6c9dc62ad3651b43d0 100644 --- a/typo3/sysext/extbase/Classes/Property/PropertyMapper.php +++ b/typo3/sysext/extbase/Classes/Property/PropertyMapper.php @@ -302,9 +302,8 @@ class PropertyMapper implements \TYPO3\CMS\Core\SingletonInterface } if (isset($convertersForSource['object'])) { return $this->findEligibleConverterWithHighestPriority($convertersForSource['object'], $source, $targetClass); - } else { - return null; } + return null; } /** @@ -362,17 +361,20 @@ class PropertyMapper implements \TYPO3\CMS\Core\SingletonInterface { if (is_string($source)) { return 'string'; - } elseif (is_array($source)) { + } + if (is_array($source)) { return 'array'; - } elseif (is_float($source)) { + } + if (is_float($source)) { return 'float'; - } elseif (is_int($source)) { + } + if (is_int($source)) { return 'integer'; - } elseif (is_bool($source)) { + } + if (is_bool($source)) { return 'boolean'; - } else { - throw new Exception\InvalidSourceException('The source is not of type string, array, float, integer or boolean, but of type "' . gettype($source) . '"', 1297773150); } + throw new Exception\InvalidSourceException('The source is not of type string, array, float, integer or boolean, but of type "' . gettype($source) . '"', 1297773150); } /** diff --git a/typo3/sysext/extbase/Classes/Property/PropertyMappingConfiguration.php b/typo3/sysext/extbase/Classes/Property/PropertyMappingConfiguration.php index e845ea60e860fa70abeae7182b90b8a7223f6214..3ef22d5a740e402a7b1a0ca71123c7a81acf7d70 100644 --- a/typo3/sysext/extbase/Classes/Property/PropertyMappingConfiguration.php +++ b/typo3/sysext/extbase/Classes/Property/PropertyMappingConfiguration.php @@ -241,7 +241,8 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf { if (isset($this->subConfigurationForProperty[$propertyName])) { return $this->subConfigurationForProperty[$propertyName]; - } elseif (isset($this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER])) { + } + if (isset($this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER])) { return $this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER]; } diff --git a/typo3/sysext/extbase/Classes/Property/TypeConverter/DateTimeConverter.php b/typo3/sysext/extbase/Classes/Property/TypeConverter/DateTimeConverter.php index e43413ba9eb6cd56a14f976246cf2123edf533fc..37375ab02e4440c6ffbf9990e42ca1c7f95f4179 100644 --- a/typo3/sysext/extbase/Classes/Property/TypeConverter/DateTimeConverter.php +++ b/typo3/sysext/extbase/Classes/Property/TypeConverter/DateTimeConverter.php @@ -199,7 +199,8 @@ class DateTimeConverter extends \TYPO3\CMS\Extbase\Property\TypeConverter\Abstra $dateFormat = $configuration->getConfigurationValue(\TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::class, self::CONFIGURATION_DATE_FORMAT); if ($dateFormat === null) { return self::DEFAULT_DATE_FORMAT; - } elseif ($dateFormat !== null && !is_string($dateFormat)) { + } + if ($dateFormat !== null && !is_string($dateFormat)) { throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException('CONFIGURATION_DATE_FORMAT must be of type string, "' . (is_object($dateFormat) ? get_class($dateFormat) : gettype($dateFormat)) . '" given', 1307719569); } return $dateFormat; diff --git a/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php b/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php index a87e7ab0c9e33dcde19c17d868791b69e3ecf912..badf8bcaff959bb91413c9080174884ed8bce73f 100644 --- a/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php +++ b/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php @@ -126,17 +126,14 @@ class ObjectConverter extends AbstractTypeConverter implements \TYPO3\CMS\Core\S $methodParameter = current($methodParameters); if (!isset($methodParameter['type'])) { throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException('Setter for property "' . $propertyName . '" had no type hint or documentation in target object of type "' . $specificTargetType . '".', 1303379158); - } else { - return $methodParameter['type']; - } - } else { - $methodParameters = $this->reflectionService->getMethodParameters($specificTargetType, '__construct'); - if (isset($methodParameters[$propertyName]) && isset($methodParameters[$propertyName]['type'])) { - return $methodParameters[$propertyName]['type']; - } else { - throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException('Property "' . $propertyName . '" had no setter or constructor argument in target object of type "' . $specificTargetType . '".', 1303379126); } + return $methodParameter['type']; + } + $methodParameters = $this->reflectionService->getMethodParameters($specificTargetType, '__construct'); + if (isset($methodParameters[$propertyName]) && isset($methodParameters[$propertyName]['type'])) { + return $methodParameters[$propertyName]['type']; } + throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException('Property "' . $propertyName . '" had no setter or constructor argument in target object of type "' . $specificTargetType . '".', 1303379126); } /** @@ -230,8 +227,7 @@ class ObjectConverter extends AbstractTypeConverter implements \TYPO3\CMS\Core\S } } return call_user_func_array([$this->objectManager, 'get'], array_merge([$objectType], $constructorArguments)); - } else { - return $this->objectManager->get($objectType); } + return $this->objectManager->get($objectType); } } diff --git a/typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php b/typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php index 7ea8070c6e5568ad21419068cf711671d54fea57..3152ff5c4b577f6c664e479cfad43340221e58fd 100644 --- a/typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php +++ b/typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php @@ -81,7 +81,8 @@ class ObjectAccess // type check and conversion of iterator to numerically indexed array if ($subject === null || is_scalar($subject)) { return null; - } elseif (!$forceDirectAccess && ($subject instanceof \SplObjectStorage || $subject instanceof ObjectStorage)) { + } + if (!$forceDirectAccess && ($subject instanceof \SplObjectStorage || $subject instanceof ObjectStorage)) { $subject = iterator_to_array(clone $subject, false); } @@ -97,9 +98,8 @@ class ObjectAccess if (property_exists($subject, $propertyName)) { $propertyReflection = new PropertyReflection($subject, $propertyName); return $propertyReflection->getValue($subject); - } else { - throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1302855001); } + throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1302855001); } $upperCasePropertyName = ucfirst($propertyName); $getterMethodName = 'get' . $upperCasePropertyName; @@ -116,9 +116,8 @@ class ObjectAccess } if (property_exists($subject, $propertyName)) { return $subject->{$propertyName}; - } else { - throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1476109666); } + throw new Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1476109666); } return null; @@ -312,7 +311,8 @@ class ObjectAccess } if ($object instanceof \stdClass && array_search($propertyName, array_keys(get_object_vars($object))) !== false) { return true; - } elseif (array_search($propertyName, array_keys(get_class_vars(get_class($object)))) !== false) { + } + if (array_search($propertyName, array_keys(get_class_vars(get_class($object)))) !== false) { return true; } return is_callable([$object, self::buildSetterMethodName($propertyName)]); @@ -334,7 +334,8 @@ class ObjectAccess } if ($object instanceof \ArrayAccess && isset($object[$propertyName])) { return true; - } elseif ($object instanceof \stdClass && isset($object->$propertyName)) { + } + if ($object instanceof \stdClass && isset($object->$propertyName)) { return true; } if (is_callable([$object, 'get' . ucfirst($propertyName)])) { diff --git a/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php b/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php index e775cbc64ab9cc6d5ead4373ee04d767a50034e3..06a284282f0497d5b5a59bdb62ce49f189d92814 100644 --- a/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php +++ b/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php @@ -275,9 +275,8 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject; if (isset($this->classSchemata[$className])) { return $this->classSchemata[$className]; - } else { - return $this->buildClassSchema($className); } + return $this->buildClassSchema($className); } /** diff --git a/typo3/sysext/extbase/Classes/Service/ImageService.php b/typo3/sysext/extbase/Classes/Service/ImageService.php index 7d71827c225ad9da7f486bcf3b23f6b8b87d3dea..51f05dcbc845e9c391ec4cb3583ad3d1812b6531 100644 --- a/typo3/sysext/extbase/Classes/Service/ImageService.php +++ b/typo3/sysext/extbase/Classes/Service/ImageService.php @@ -107,9 +107,8 @@ class ImageService implements \TYPO3\CMS\Core\SingletonInterface $uriPrefix = (GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https:' : 'http:') . $uriPrefix; } return GeneralUtility::locationHeaderUrl($uriPrefix . $imageUrl); - } else { - return $uriPrefix . $imageUrl; } + return $uriPrefix . $imageUrl; } /** diff --git a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php index e6dc178feee98faebe044ba20aedd372351cf372..bfe3d9bf184fa6e369d817d3e08c63e94fe85c4a 100644 --- a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php +++ b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php @@ -140,12 +140,12 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface if (!is_array($slotReturn)) { throw new Exception\InvalidSlotReturnException('The slot method ' . get_class($object) . '->' . $slotInformation['method'] . '()\'s return value is of an not allowed type (' . gettype($slotReturn) . ').', 1376683067); - } elseif (count($slotReturn) !== count($signalArguments)) { + } + if (count($slotReturn) !== count($signalArguments)) { throw new Exception\InvalidSlotReturnException('The slot method ' . get_class($object) . '->' . $slotInformation['method'] . '() returned a different number (' . count($slotReturn) . ') of arguments, than it received (' . count($signalArguments) . ').', 1376683066); - } else { - $signalArguments = $slotReturn; } + $signalArguments = $slotReturn; } } diff --git a/typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php b/typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php index 5711fb2ec88f60a148182a12e6d7eebbaaba01b6..c524e71928cca6c620066160cf1b8cfdccab5367 100644 --- a/typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php +++ b/typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php @@ -188,9 +188,8 @@ class DebuggerUtility } if ($plainText) { return $header . $content; - } else { - return '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>'; } + return '<span class="extbase-debugger-tree">' . $header . '<span class="extbase-debug-content">' . $content . '</span></span>'; } /** @@ -212,9 +211,8 @@ class DebuggerUtility } if ($plainText) { return $header . $content; - } else { - return '<span class="extbase-debugger-tree"><input type="checkbox" /><span class="extbase-debug-header">' . $header . '</span><span class="extbase-debug-content">' . $content . '</span></span>'; } + return '<span class="extbase-debugger-tree"><input type="checkbox" /><span class="extbase-debug-header">' . $header . '</span><span class="extbase-debug-content">' . $content . '</span></span>'; } /** @@ -484,9 +482,8 @@ class DebuggerUtility { if ($enable) { return '[' . $ansiColors . 'm' . $string . '[0m'; - } else { - return $string; } + return $string; } /** @@ -569,9 +566,9 @@ class DebuggerUtility self::$blacklistedPropertyNames = $backupBlacklistedPropertyNames; if ($return === true) { return $css . $output; - } else { - echo $css . $output; } + echo $css . $output; + return ''; } } diff --git a/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php b/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php index 256d0759abf557dbb8fc3316ba284edf95d966d0..1dd951a214cdb39c27d3bcc8f3eb96b4a3623efe 100644 --- a/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php +++ b/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php @@ -119,9 +119,8 @@ class LocalizationUtility } if (is_array($arguments) && $value !== null) { return vsprintf($value, $arguments); - } else { - return $value; } + return $value; } /** @@ -137,12 +136,12 @@ class LocalizationUtility if (TYPO3_MODE === 'FE') { $value = self::getTypoScriptFrontendController()->sL($key); return $value !== false ? $value : null; - } elseif (is_object($GLOBALS['LANG'])) { + } + if (is_object($GLOBALS['LANG'])) { $value = self::getLanguageService()->sL($key); return $value !== '' ? $value : null; - } else { - return $key; } + return $key; } /** diff --git a/typo3/sysext/extbase/Classes/Utility/TypeHandlingUtility.php b/typo3/sysext/extbase/Classes/Utility/TypeHandlingUtility.php index da0b32daff798b31952aa4c8d84a524e8a05e101..a363b856ac46b5cc3c7c6aebd4c522261a974c9f 100644 --- a/typo3/sysext/extbase/Classes/Utility/TypeHandlingUtility.php +++ b/typo3/sysext/extbase/Classes/Utility/TypeHandlingUtility.php @@ -54,9 +54,8 @@ class TypeHandlingUtility 'type' => $type, 'elementType' => $elementType ]; - } else { - throw new \TYPO3\CMS\Extbase\Utility\Exception\InvalidTypeException('Found an invalid element type declaration in %s. A type "' . var_export($type, true) . '" does not exist.', 1264093630); } + throw new \TYPO3\CMS\Extbase\Utility\Exception\InvalidTypeException('Found an invalid element type declaration in %s. A type "' . var_export($type, true) . '" does not exist.', 1264093630); } /** diff --git a/typo3/sysext/extbase/Classes/Validation/Validator/CollectionValidator.php b/typo3/sysext/extbase/Classes/Validation/Validator/CollectionValidator.php index 9c0d47bddfc42ab7303856998876a618f08a806f..45705b95a52f1e6fe4b2d19646ef62cd5ace1e0b 100644 --- a/typo3/sysext/extbase/Classes/Validation/Validator/CollectionValidator.php +++ b/typo3/sysext/extbase/Classes/Validation/Validator/CollectionValidator.php @@ -59,13 +59,14 @@ class CollectionValidator extends GenericObjectValidator if ((is_object($value) && !\TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isCollectionType(get_class($value))) && !is_array($value)) { $this->addError('The given subject was not a collection.', 1317204797); return $this->result; - } elseif ($value instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage && !$value->isInitialized()) { + } + if ($value instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage && !$value->isInitialized()) { return $this->result; - } elseif (is_object($value) && $this->isValidatedAlready($value)) { + } + if (is_object($value) && $this->isValidatedAlready($value)) { return $this->result; - } else { - $this->isValid($value); } + $this->isValid($value); } return $this->result; } diff --git a/typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php b/typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php index 97ccecccb27b0e7f88c288f374725f0fa87e3344..a45aaf95943aca79ba2f0a7156ad2deeffeaba62 100644 --- a/typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php +++ b/typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php @@ -62,9 +62,8 @@ class GenericObjectValidator extends AbstractValidator implements ObjectValidato // @todo add support for lazy loading proxies, if needed if (ObjectAccess::isPropertyGettable($object, $propertyName)) { return ObjectAccess::getProperty($object, $propertyName); - } else { - return ObjectAccess::getProperty($object, $propertyName, true); } + return ObjectAccess::getProperty($object, $propertyName, true); } /** @@ -149,11 +148,10 @@ class GenericObjectValidator extends AbstractValidator implements ObjectValidato } if ($this->validatedInstancesContainer->contains($object)) { return true; - } else { - $this->validatedInstancesContainer->attach($object); - - return false; } + $this->validatedInstancesContainer->attach($object); + + return false; } /** @@ -166,9 +164,8 @@ class GenericObjectValidator extends AbstractValidator implements ObjectValidato { if ($propertyName !== null) { return (isset($this->propertyValidators[$propertyName])) ? $this->propertyValidators[$propertyName] : []; - } else { - return $this->propertyValidators; } + return $this->propertyValidators; } /** diff --git a/typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php b/typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php index 899bfef624f131293b3bd31f13137aac42d9ee3d..689f4417ededac8957904f6ea537f7871a4b9400 100644 --- a/typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Property/TypeConverter/PersistentObjectConverterTest.php @@ -80,9 +80,8 @@ class PersistentObjectConverterTest extends \TYPO3\TestingFramework\Core\Unit\Un $reflectionClass = new \ReflectionClass($className); if (empty($arguments)) { return $reflectionClass->newInstance(); - } else { - return $reflectionClass->newInstanceArgs($arguments); } + return $reflectionClass->newInstanceArgs($arguments); })); $this->inject($this->converter, 'objectManager', $this->mockObjectManager); diff --git a/typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php b/typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php index 0045d3195fc18ee03fa6e1ea436181e805df7808..d8490f6edb9e6c9bb6ff93cb956be0c0d0e2c8a1 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php @@ -396,12 +396,11 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface 'The extension ' . $extensionKey . ' is not available from TER.', 1399161266 ); - } else { - throw new Exception\MissingExtensionDependencyException( + } + throw new Exception\MissingExtensionDependencyException( 'The extension ' . $extensionKey . ' could not be checked. Please update your Extension-List from TYPO3 Extension Repository (TER).', 1430580308 ); - } } return; } @@ -626,12 +625,11 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface if (!array_key_exists($extensionKey, $filteredExtensions)) { $filteredExtensions[$extensionKey] = $extension; continue; - } else { - $currentVersion = $filteredExtensions[$extensionKey]->getVersion(); - $newVersion = $extension->getVersion(); - if (version_compare($newVersion, $currentVersion, '>')) { - $filteredExtensions[$extensionKey] = $extension; - } + } + $currentVersion = $filteredExtensions[$extensionKey]->getVersion(); + $newVersion = $extension->getVersion(); + if (version_compare($newVersion, $currentVersion, '>')) { + $filteredExtensions[$extensionKey] = $extension; } } return $filteredExtensions; diff --git a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php index 65b16b62f55884170b47d61896ecc5c82439e33f..091c8c7047e091a0676bbde088a81c6ea06ff541 100644 --- a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php +++ b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php @@ -197,9 +197,8 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface ), 1342554622 ); - } else { - $this->unloadExtension($extensionKey); } + $this->unloadExtension($extensionKey); } /** @@ -329,9 +328,8 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface $availableExtensions = $this->listUtility->getAvailableExtensions(); if (isset($availableExtensions[$extensionKey])) { return $availableExtensions[$extensionKey]; - } else { - throw new ExtensionManagerException('Extension ' . $extensionKey . ' is not available', 1342864081); } + throw new ExtensionManagerException('Extension ' . $extensionKey . ' is not available', 1342864081); } /** diff --git a/typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php b/typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php index 1bc68c6276cdf6e83e22f7e80225d7bcf8b7cdc2..fa9c6baeae178d926dd3a87f0c3c1cd745718f86 100644 --- a/typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php +++ b/typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php @@ -127,9 +127,8 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst { if ($this->hasArgument('fieldNamePrefix')) { return $this->arguments['fieldNamePrefix']; - } else { - return $this->getDefaultFieldNamePrefix(); } + return $this->getDefaultFieldNamePrefix(); } /** @@ -152,8 +151,7 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst } if ($extensionName !== null && $pluginName != null) { return $this->extensionService->getPluginNamespace($extensionName, $pluginName); - } else { - return ''; } + return ''; } } diff --git a/typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php b/typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php index ee71dee4002233462886cc2d02807098491ba25b..1ab37424dc624178636b4e39bd406f8411c516e2 100644 --- a/typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php +++ b/typo3/sysext/extensionmanager/Classes/ViewHelpers/InstallationStateCssClassViewHelper.php @@ -56,9 +56,8 @@ class InstallationStateCssClassViewHelper extends AbstractViewHelper if (array_key_exists($needle, $haystack)) { if (isset($haystack[$needle]['installed']) && $haystack[$needle]['installed'] === true) { return 'installed'; - } else { - return 'available'; } + return 'available'; } return ''; } diff --git a/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php b/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php index 27476bf79429ccb7856e186e2fbc5b39d8feb196..6792f1166ee3ca486caefb98a35f7d62b87ca07b 100644 --- a/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php +++ b/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php @@ -927,9 +927,8 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin } if ($returnUrl) { return htmlspecialchars($this->cObj->typoLink_URL($this->conf['linkConfig.'])); - } else { - return $this->cObj->typoLink($label, $this->conf['linkConfig.']); } + return $this->cObj->typoLink($label, $this->conf['linkConfig.']); } /** diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php index bce7459fb93cb84903f8a2e38918e0c31fb0e6fe..98d0ca5bf15bddee06ea48b7b19cfb596e184fc9 100644 --- a/typo3/sysext/filelist/Classes/FileList.php +++ b/typo3/sysext/filelist/Classes/FileList.php @@ -575,9 +575,8 @@ class FileList extends AbstractRecordList // Sometimes $code contains plain HTML tags. In such a case the string should not be modified! if ((string)$title === strip_tags($title)) { return '<a href="' . htmlspecialchars($href) . '"' . $onclick . ' title="' . htmlspecialchars($title) . '">' . $title . '</a>'; - } else { - return '<a href="' . htmlspecialchars($href) . '"' . $onclick . '>' . $title . '</a>'; } + return '<a href="' . htmlspecialchars($href) . '"' . $onclick . '>' . $title . '</a>'; } /** @@ -643,9 +642,8 @@ class FileList extends AbstractRecordList $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) { if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) { return false; - } else { - return true; } + return true; }); foreach ($files as $fileObject) { diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php index 07c243e1f70f910b5d0b30f65a0cd9e7a13406a4..353e8e639c47bb9377969f6bd4802ce9dbdb83e7 100644 --- a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php +++ b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php @@ -38,9 +38,8 @@ abstract class AbstractConditionViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHe { if (static::evaluateCondition($this->arguments)) { return $this->renderThenChild(); - } else { - return $this->renderElseChild(); } + return $this->renderElseChild(); } /** diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php index 5bffd10637713ba199d185d1ef9a9f0448f5c4d4..3dba9f82634fe94193c7ae4eec00967472e2ee48 100644 --- a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php +++ b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php @@ -81,9 +81,8 @@ abstract class AbstractViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\Abst if (GeneralUtility::getApplicationContext()->isProduction()) { $this->getLogger()->error('A Fluid ViewHelper Exception was captured: ' . $exception->getMessage() . ' (' . $exception->getCode() . ')', ['exception' => $exception]); return ''; - } else { - throw $exception; } + throw $exception; } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfAuthenticatedViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfAuthenticatedViewHelper.php index 199fdd6ec4dd1d0ddd1dd198daab06e68d8e6f03..768412b9c8d293b6a8163a9a9052ea7ad5369cd7 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfAuthenticatedViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfAuthenticatedViewHelper.php @@ -65,8 +65,7 @@ class IfAuthenticatedViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstrac { if (static::evaluateCondition($this->arguments)) { return $this->renderThenChild(); - } else { - return $this->renderElseChild(); } + return $this->renderElseChild(); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfHasRoleViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfHasRoleViewHelper.php index 580a4468264edc903cd708601d5b7d9299293c01..cf3305a64a6bb9ef321183ed8d32f162872dd0fa 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfHasRoleViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Security/IfHasRoleViewHelper.php @@ -101,8 +101,7 @@ class IfHasRoleViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractCondi { if (static::evaluateCondition($this->arguments)) { return $this->renderThenChild(); - } else { - return $this->renderElseChild(); } + return $this->renderElseChild(); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php index 874e0061229ba2023b320930b72ecd977b4d361b..20eb6fd97eeb36f7cb79c220b791461472d749ac 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php @@ -127,12 +127,11 @@ class FlashMessagesViewHelper extends AbstractViewHelper return GeneralUtility::makeInstance(FlashMessageRendererResolver::class) ->resolve() ->render($flashMessages); - } else { - $templateVariableContainer = $renderingContext->getVariableProvider(); - $templateVariableContainer->add($as, $flashMessages); - $content = $renderChildrenClosure(); - $templateVariableContainer->remove($as); } + $templateVariableContainer = $renderingContext->getVariableProvider(); + $templateVariableContainer->add($as, $flashMessages); + $content = $renderChildrenClosure(); + $templateVariableContainer->remove($as); return $content; } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Form/Select/OptionViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Form/Select/OptionViewHelper.php index 8884f46dabb15077f4f9eb2ff46fe0b94066f0ed..981fd325c504bdfafa7e13bde818fc1e6872cb71 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Form/Select/OptionViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Form/Select/OptionViewHelper.php @@ -80,7 +80,8 @@ class OptionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFie $selectedValue = $this->viewHelperVariableContainer->get(SelectViewHelper::class, 'selectedValue'); if (is_array($selectedValue)) { return in_array($value, $selectedValue); - } elseif ($selectedValue instanceof \Iterator) { + } + if ($selectedValue instanceof \Iterator) { return in_array($value, iterator_to_array($selectedValue)); } return $value == $selectedValue; diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php index b7c3bc42812f4458e8881d1b504a20796934b08c..574c1ab198ff92cd7c7640e8fd50057d7cdead7c 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Form/SelectViewHelper.php @@ -273,7 +273,8 @@ class SelectViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFie if ($this->hasArgument('multiple')) { if (is_null($selectedValue) && $this->arguments['selectAllByDefault'] === true) { return true; - } elseif (is_array($selectedValue) && in_array($value, $selectedValue)) { + } + if (is_array($selectedValue) && in_array($value, $selectedValue)) { return true; } } @@ -310,17 +311,14 @@ class SelectViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFie if (is_object($valueElement)) { if ($this->hasArgument('optionValueField')) { return \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($valueElement, $this->arguments['optionValueField']); - } else { - // @todo use $this->persistenceManager->isNewObject() once it is implemented - if ($this->persistenceManager->getIdentifierByObject($valueElement) !== null) { - return $this->persistenceManager->getIdentifierByObject($valueElement); - } else { - return (string)$valueElement; - } } - } else { - return $valueElement; + // @todo use $this->persistenceManager->isNewObject() once it is implemented + if ($this->persistenceManager->getIdentifierByObject($valueElement) !== null) { + return $this->persistenceManager->getIdentifierByObject($valueElement); + } + return (string)$valueElement; } + return $valueElement; } /** diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php index 05de4f7bc3d186ce239b23e6f58ce47df064680b..10d7b46c9b8719d6ec4282605a1a6d5193ad9d91 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php @@ -348,9 +348,8 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH { if ($this->hasArgument('fieldNamePrefix')) { return $this->arguments['fieldNamePrefix']; - } else { - return $this->getDefaultFieldNamePrefix(); } + return $this->getDefaultFieldNamePrefix(); } /** @@ -431,9 +430,8 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH } if ($extensionName !== null && $pluginName != null) { return $this->extensionService->getPluginNamespace($extensionName, $pluginName); - } else { - return ''; } + return ''; } /** diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php index f1d1f5ae1cd0bdbf22f033dd68d1924b4cd422c4..50d0d1874382031577135ebfaee805bdd41a2537 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php @@ -149,8 +149,7 @@ class DateViewHelper extends AbstractViewHelper if (strpos($format, '%') !== false) { return strftime($format, $date->format('U')); - } else { - return $date->format($format); } + return $date->format($format); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php index 81a1b27dec09a2234f53cc2ffd56920989280833..c979e5bbe54a4231d6e7e78d814db63c48a9eb88 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php @@ -101,10 +101,9 @@ class MediaViewHelper extends AbstractTagBasedViewHelper // Fallback to image when no renderer is found if ($fileRenderer === null) { return $this->renderImage($file, $width, $height); - } else { - $additionalConfig = array_merge_recursive($this->arguments, $additionalConfig); - return $fileRenderer->render($file, $width, $height, $additionalConfig); } + $additionalConfig = array_merge_recursive($this->arguments, $additionalConfig); + return $fileRenderer->render($file, $width, $height, $additionalConfig); } /** diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php index d1f5564784fbb55470b368577665634639d24ada..4340be5fbad88a316b6b236dd2ed93606080fda1 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php @@ -65,8 +65,7 @@ class IfAuthenticatedViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstrac { if (static::evaluateCondition($this->arguments)) { return $this->renderThenChild(); - } else { - return $this->renderElseChild(); } + return $this->renderElseChild(); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php index 5ebebebd0878ea9bb79aeb6da486b6614875fc5b..1de981024e78739bdbffcfed481c65bbcff28670 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php @@ -80,9 +80,8 @@ class IfHasRoleViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractCondi } if (is_numeric($role)) { return is_array($GLOBALS['TSFE']->fe_user->groupData['uid']) && in_array($role, $GLOBALS['TSFE']->fe_user->groupData['uid']); - } else { - return is_array($GLOBALS['TSFE']->fe_user->groupData['title']) && in_array($role, $GLOBALS['TSFE']->fe_user->groupData['title']); } + return is_array($GLOBALS['TSFE']->fe_user->groupData['title']) && in_array($role, $GLOBALS['TSFE']->fe_user->groupData['title']); } /** @@ -92,8 +91,7 @@ class IfHasRoleViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractCondi { if (static::evaluateCondition($this->arguments)) { return $this->renderThenChild(); - } else { - return $this->renderElseChild(); } + return $this->renderElseChild(); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/EmailViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/EmailViewHelper.php index 42ae3f9856253272c11c5785fbeb366c79ab2e2e..ea882502f0a4214fdb35bcd558a763a5c0c640f1 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/EmailViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/EmailViewHelper.php @@ -60,8 +60,7 @@ class EmailViewHelper extends AbstractViewHelper if (TYPO3_MODE === 'FE') { $emailParts = $GLOBALS['TSFE']->cObj->getMailTo($email, $email); return reset($emailParts); - } else { - return 'mailto:' . $email; } + return 'mailto:' . $email; } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php b/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php index c34cbce426f429f0d1dc943d516f9385d890827b..878a60e742c710a13fc04b35a3b0c5560778205e 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Widget/Controller/PaginateController.php @@ -177,7 +177,8 @@ class PaginateController extends AbstractWidgetController } $modifiedObjects = $query->execute(); return $modifiedObjects; - } elseif ($this->objects instanceof ObjectStorage) { + } + if ($this->objects instanceof ObjectStorage) { $modifiedObjects = []; $objectArray = $this->objects->toArray(); $endOfRange = min($offset + $itemsPerPage, count($objectArray)); @@ -185,16 +186,16 @@ class PaginateController extends AbstractWidgetController $modifiedObjects[] = $objectArray[$i]; } return $modifiedObjects; - } elseif (is_array($this->objects)) { + } + if (is_array($this->objects)) { $modifiedObjects = array_slice($this->objects, $offset, $itemsPerPage); return $modifiedObjects; - } else { - throw new \InvalidArgumentException( + } + throw new \InvalidArgumentException( 'The view helper "' . get_class($this) . '" accepts as argument "QueryResultInterface", "\SplObjectStorage", "ObjectStorage" or an array. ' . 'given: ' . get_class($this->objects), 1385547291 ); - } } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Widget/UriViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Widget/UriViewHelper.php index b1d4a310cf08d2f51eca5b06315dbd8264a31575..0573edced32e21e858bd0ad4d5c9dfb5fb0a0100 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Widget/UriViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Widget/UriViewHelper.php @@ -63,9 +63,8 @@ class UriViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper if ($ajax === true) { return static::getAjaxUri($renderingContext, $arguments); - } else { - return static::getWidgetUri($renderingContext, $arguments); } + return static::getWidgetUri($renderingContext, $arguments); } /** diff --git a/typo3/sysext/form/Classes/Domain/Model/FormDefinition.php b/typo3/sysext/form/Classes/Domain/Model/FormDefinition.php index 2bee2f5a1d2c678f0a54aeea15119929326b9bb3..7eb612264c0d1dc9469044c693c495ea4939b9fc 100644 --- a/typo3/sysext/form/Classes/Domain/Model/FormDefinition.php +++ b/typo3/sysext/form/Classes/Domain/Model/FormDefinition.php @@ -504,9 +504,8 @@ class FormDefinition extends AbstractCompositeRenderable $finisher->setOptions($defaultOptions); $this->addFinisher($finisher); return $finisher; - } else { - throw new FinisherPresetNotFoundException('The finisher preset identified by "' . $finisherIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328709784); } + throw new FinisherPresetNotFoundException('The finisher preset identified by "' . $finisherIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328709784); } /** diff --git a/typo3/sysext/form/Classes/Domain/Model/Renderable/AbstractRenderable.php b/typo3/sysext/form/Classes/Domain/Model/Renderable/AbstractRenderable.php index f1b1298249af84c2731814d6d000cc8638e58f45..ce6ae11de7c2cbc32d132ef86c80508500884c73 100644 --- a/typo3/sysext/form/Classes/Domain/Model/Renderable/AbstractRenderable.php +++ b/typo3/sysext/form/Classes/Domain/Model/Renderable/AbstractRenderable.php @@ -190,9 +190,8 @@ abstract class AbstractRenderable implements RenderableInterface ->get($implementationClassName, $defaultOptions); $this->addValidator($validator); return $validator; - } else { - throw new ValidatorPresetNotFoundException('The validator preset identified by "' . $validatorIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328710202); } + throw new ValidatorPresetNotFoundException('The validator preset identified by "' . $validatorIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328710202); } /** diff --git a/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php b/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php index 0a257e99a57e3e0558553a8f63339e5bb32fe97a..153395745f4cda3070c41a4191725abefc3b7a92 100644 --- a/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php +++ b/typo3/sysext/form/Classes/Mvc/Property/TypeConverter/UploadedFileReferenceConverter.php @@ -146,9 +146,8 @@ class UploadedFileReferenceConverter extends AbstractTypeConverter if (strpos($resourcePointer, 'file:') === 0) { $fileUid = substr($resourcePointer, 5); return $this->createFileReferenceFromFalFileObject($this->resourceFactory->getFileObject($fileUid)); - } else { - return $this->createFileReferenceFromFalFileReferenceObject($this->resourceFactory->getFileReferenceObject($resourcePointer), $resourcePointer); } + return $this->createFileReferenceFromFalFileReferenceObject($this->resourceFactory->getFileReferenceObject($resourcePointer), $resourcePointer); } catch (\InvalidArgumentException $e) { // Nothing to do. No file is uploaded and resource pointer is invalid. Discard! } diff --git a/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php b/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php index a302e04a40694042cdc71b0ebeebc370031c4822..29725a81c6d7af34ec1d3f78c888a301b6a4cbff 100644 --- a/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php +++ b/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php @@ -131,9 +131,8 @@ class RenderAllFormValuesViewHelper extends AbstractViewHelper ); if (is_array($value)) { return self::mapValuesToOptions($value, $properties['options']); - } else { - return self::mapValueToOption($value, $properties['options']); } + return self::mapValueToOption($value, $properties['options']); } if (is_object($value)) { return self::processObject($element, $value); diff --git a/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php b/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php index e161508021c504cb6677bed5b066d701d79cc9e2..1f597c3c14ab22cf03462d0c5dd83fd48c67ad26 100644 --- a/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php +++ b/typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php @@ -42,8 +42,8 @@ class ConditionMatcher extends AbstractConditionMatcher if (is_bool($result)) { return $result; - } else { - switch ($key) { + } + switch ($key) { case 'usergroup': $groupList = $this->getGroupList(); // '0,-1' is the default usergroups when not logged in! @@ -84,7 +84,6 @@ class ConditionMatcher extends AbstractConditionMatcher return $conditionResult; } } - } return false; } diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 20afcff95318d607acb75a93bfd8fae494a8af88..d1256cfae21c7b4a29d92e7cdc819b4261acd983 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -821,9 +821,8 @@ class ContentObjectRenderer $exceptionHandler = $this->createExceptionHandler($configuration); if ($exceptionHandler === null) { throw $exception; - } else { - $content = $exceptionHandler->handle($exception, $contentObject, $configuration); } + $content = $exceptionHandler->handle($exception, $contentObject, $configuration); } // Store cache @@ -2091,9 +2090,8 @@ class ContentObjectRenderer if (!empty($conf['csConv'])) { $output = mb_convert_encoding($content, 'utf-8', trim(strtolower($conf['csConv']))); return $output !== false && $output !== '' ? $output : $content; - } else { - return $content; } + return $content; } /** @@ -3356,9 +3354,8 @@ class ContentObjectRenderer $options = GeneralUtility::intExplode(',', $options . ','); if ($options[1]) { return mb_substr($content, $options[0], $options[1], 'utf-8'); - } else { - return mb_substr($content, $options[0], null, 'utf-8'); } + return mb_substr($content, $options[0], null, 'utf-8'); } /** @@ -3496,9 +3493,8 @@ class ContentObjectRenderer } $splittedContent[$offset] = $tempContent; break; - } else { - $strLen += $thisStrLen; } + $strLen += $thisStrLen; } } // Close cropped tags. @@ -4786,14 +4782,14 @@ class ContentObjectRenderer { if (!strstr($field, '//')) { return $this->data[trim($field)]; - } else { - $sections = GeneralUtility::trimExplode('//', $field, true); - foreach ($sections as $k) { - if ((string)$this->data[$k] !== '') { - return $this->data[$k]; - } + } + $sections = GeneralUtility::trimExplode('//', $field, true); + foreach ($sections as $k) { + if ((string)$this->data[$k] !== '') { + return $this->data[$k]; } } + return ''; } @@ -4915,7 +4911,8 @@ class ContentObjectRenderer if ($retVal === '-1') { $retVal = 'none'; break; - } elseif ($retVal !== '' && $retVal !== '0') { + } + if ($retVal !== '' && $retVal !== '0') { // Stop searching if a layout for "next level" is set break; } @@ -5094,14 +5091,14 @@ class ContentObjectRenderer $rootLine = is_array($altRootLine) ? $altRootLine : $this->getTypoScriptFrontendController()->tmpl->rootLine; if (!$slideBack) { return $rootLine[$key][$field]; - } else { - for ($a = $key; $a >= 0; $a--) { - $val = $rootLine[$a][$field]; - if ($val) { - return $val; - } + } + for ($a = $key; $a >= 0; $a--) { + $val = $rootLine[$a][$field]; + if ($val) { + return $val; } } + return ''; } diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php index 5af87d622f541861ba8fa162bd9c26eb2868780c..d53907230d20c448ad7f2f242e20ca30073ecee5 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php @@ -195,9 +195,8 @@ class TextMenuContentObject extends AbstractMenuContentObject $processedPref = isset($this->I['val'][$pref . '.']) ? $this->WMcObj->stdWrap($this->I['val'][$pref], $this->I['val'][$pref . '.']) : $this->I['val'][$pref]; if (isset($this->I['val'][$pref . 'Wrap'])) { return $this->WMcObj->wrap($res . $processedPref, $this->I['val'][$pref . 'Wrap']); - } else { - return $res . $processedPref; } + return $res . $processedPref; } /** diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 1bc53348d98f27b602ce67039399599f83693be2..64ec04c636ad1a4d91afae2c0426b5dc5aa7f0ca 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -1846,14 +1846,12 @@ class TypoScriptFrontendController $pageUid = $this->sys_page->getDomainStartPage(implode('.', $host), GeneralUtility::getIndpEnv('SCRIPT_NAME'), GeneralUtility::getIndpEnv('REQUEST_URI')); if ($pageUid) { return $pageUid; - } else { - array_shift($host); } + array_shift($host); } return $pageUid; - } else { - return $this->sys_page->getDomainStartPage(GeneralUtility::getIndpEnv('HTTP_HOST'), GeneralUtility::getIndpEnv('SCRIPT_NAME'), GeneralUtility::getIndpEnv('REQUEST_URI')); } + return $this->sys_page->getDomainStartPage(GeneralUtility::getIndpEnv('HTTP_HOST'), GeneralUtility::getIndpEnv('SCRIPT_NAME'), GeneralUtility::getIndpEnv('REQUEST_URI')); } /** @@ -2224,11 +2222,10 @@ class TypoScriptFrontendController if (is_array($pageSectionCacheContent)) { // we have the content, nice that some other process did the work for us already $this->releaseLock('pagesection'); - } else { - // We keep the lock set, because we are the ones generating the page now + } + // We keep the lock set, because we are the ones generating the page now // and filling the cache. // This indicates that we have to release the lock in the Registry later in releaseLocks() - } } if (is_array($pageSectionCacheContent)) { @@ -2262,11 +2259,10 @@ class TypoScriptFrontendController if (is_array($row)) { // we have the content, nice that some other process did the work for us $this->releaseLock('pages'); - } else { - // We keep the lock set, because we are the ones generating the page now + } + // We keep the lock set, because we are the ones generating the page now // and filling the cache. // This indicates that we have to release the lock in the Registry later in releaseLocks() - } } if (is_array($row)) { // we have data from cache @@ -4155,7 +4151,8 @@ class TypoScriptFrontendController { if (isset($LOCAL_LANG[$this->lang][$index][0]['target'])) { return $LOCAL_LANG[$this->lang][$index][0]['target']; - } elseif (isset($LOCAL_LANG['default'][$index][0]['target'])) { + } + if (isset($LOCAL_LANG['default'][$index][0]['target'])) { return $LOCAL_LANG['default'][$index][0]['target']; } return false; @@ -4530,9 +4527,8 @@ class TypoScriptFrontendController $this->locks[$type]['accessLock']->release(); if ($locked) { break; - } else { - throw new \RuntimeException('Could not acquire page lock for ' . $key . '.', 1460975877); } + throw new \RuntimeException('Could not acquire page lock for ' . $key . '.', 1460975877); } while (true); } diff --git a/typo3/sysext/frontend/Classes/Page/ExternalPageUrlHandler.php b/typo3/sysext/frontend/Classes/Page/ExternalPageUrlHandler.php index 1448930f8c24b0eb945c327d1ffe2c60ab420923..7aeea85464e02067132f27164dbb749a51cbd6fb 100644 --- a/typo3/sysext/frontend/Classes/Page/ExternalPageUrlHandler.php +++ b/typo3/sysext/frontend/Classes/Page/ExternalPageUrlHandler.php @@ -42,9 +42,8 @@ class ExternalPageUrlHandler implements \TYPO3\CMS\Frontend\Http\UrlHandlerInter $this->externalUrl = $tsfe->sys_page->getExtURL($tsfe->page); if (empty($this->externalUrl)) { return false; - } else { - return true; } + return true; } /** diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php index 4385ba325fb43040a38cd34bcc9d93960637d2a9..b23ccb851d13ccfc5572d464ca327dad56d6c990 100644 --- a/typo3/sysext/frontend/Classes/Page/PageRepository.php +++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php @@ -902,9 +902,8 @@ class PageRepository HttpUtility::redirect($redirectUrl, HttpUtility::HTTP_STATUS_301); } die; - } else { - return $row['uid']; } + return $row['uid']; } /** @@ -939,7 +938,8 @@ class PageRepository $this->error_getRootLine_failPid = -1; } return []; - } elseif ($ex->getCode() === 1343589451) { + } + if ($ex->getCode() === 1343589451) { /** @see \TYPO3\CMS\Core\Utility\RootlineUtility::getRecordArray */ return []; } @@ -1131,12 +1131,10 @@ class PageRepository ->fetchColumn(); if ($numRows > 0) { return $row; - } else { - return 0; } - } else { - return $row; + return 0; } + return $row; } } } @@ -1752,24 +1750,21 @@ class PageRepository if ($bypassEnableFieldsCheck || $queryBuilder->execute()->fetchColumn()) { // Return offline version, tested for its enableFields. return $newrow; - } else { - // Return -1 because offline version was de-selected due to its enableFields. - return -1; } - } else { - // OK, so no workspace version was found. Then check if online version can be - // selected with full enable fields and if so, return 1: - $queryBuilder->where( + // Return -1 because offline version was de-selected due to its enableFields. + return -1; + } + // OK, so no workspace version was found. Then check if online version can be + // selected with full enable fields and if so, return 1: + $queryBuilder->where( $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)) ); - if ($bypassEnableFieldsCheck || $queryBuilder->execute()->fetchColumn()) { - // Means search was done, but no version found. - return 1; - } else { - // Return -2 because the online record was de-selected due to its enableFields. - return -2; - } + if ($bypassEnableFieldsCheck || $queryBuilder->execute()->fetchColumn()) { + // Means search was done, but no version found. + return 1; } + // Return -2 because the online record was de-selected due to its enableFields. + return -2; } // No look up in database because versioning not enabled / or workspace not // offline diff --git a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php index 6cdbaa2c68bcddfc1a7005d5c977e05571310acf..38ccc8c044da72f0ebc0bf29e3163dd78d1b952e 100644 --- a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php +++ b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php @@ -883,12 +883,10 @@ class AbstractPlugin if ($panel) { if ($label) { return '<!-- BEGIN: EDIT PANEL --><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">' . $label . '</td><td valign="top" align="right">' . $panel . '</td></tr></table><!-- END: EDIT PANEL -->'; - } else { - return '<!-- BEGIN: EDIT PANEL -->' . $panel . '<!-- END: EDIT PANEL -->'; } - } else { - return $label; + return '<!-- BEGIN: EDIT PANEL -->' . $panel . '<!-- END: EDIT PANEL -->'; } + return $label; } /** diff --git a/typo3/sysext/frontend/Classes/Resource/FileCollector.php b/typo3/sysext/frontend/Classes/Resource/FileCollector.php index b2fe32fe12a727edc1cba41463f555ba6c454374..5876b25fdee5ecefc200d79eb0ca6239f231bf39 100644 --- a/typo3/sysext/frontend/Classes/Resource/FileCollector.php +++ b/typo3/sysext/frontend/Classes/Resource/FileCollector.php @@ -210,9 +210,8 @@ class FileCollector implements \Countable ) use ($sortingProperty) { if ($a->hasProperty($sortingProperty) && $b->hasProperty($sortingProperty)) { return strnatcasecmp($a->getProperty($sortingProperty), $b->getProperty($sortingProperty)); - } else { - return 0; } + return 0; } ); diff --git a/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php b/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php index 48ec05cbbc548db6bb693093713132e79eebf95c..2158ce6b899d0cb3cdabd665461abd89e5ba9d58 100644 --- a/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php +++ b/typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php @@ -113,9 +113,8 @@ abstract class AbstractTypolinkBuilder { if ($originalLinkText === '') { return $this->contentObjectRenderer->parseFunc($fallbackLinkText, ['makelinks' => 0], '< lib.parseFunc'); - } else { - return $originalLinkText; } + return $originalLinkText; } /** diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php index 231ae1dfc7e0c1e229feed3b5cf843ddf84f1afc..b1e2a474b69fb1ee9a5f3f86179eccb002d11772 100644 --- a/typo3/sysext/impexp/Classes/Import.php +++ b/typo3/sysext/impexp/Classes/Import.php @@ -774,7 +774,6 @@ class Import extends ImportExport foreach ($uidList as $uid) { if ($this->dontIgnorePid($tableName, $uid)) { $cmd_data[$tableName][$uid]['move'] = $newPid; - } else { } } } @@ -1117,9 +1116,8 @@ class Import extends ImportExport $this->alternativeFileName[$tmpFile] = $fI['filename']; $this->alternativeFilePath[$tmpFile] = $this->dat['files'][$fI['ID']]['relFileRef']; return $tmpFile; - } else { - $this->error('Error: temporary file ' . $tmpFile . ' had a size (' . filesize($tmpFile) . ') different from the original (' . $this->dat['files'][$fI['ID']]['filesize'] . ')'); } + $this->error('Error: temporary file ' . $tmpFile . ' had a size (' . filesize($tmpFile) . ') different from the original (' . $this->dat['files'][$fI['ID']]['filesize'] . ')'); } else { $this->error('Error: temporary file ' . $tmpFile . ' was not written as it should have been!'); } @@ -1462,9 +1460,8 @@ class Import extends ImportExport $this->writeFileVerify($origDestName, $fileHeaderInfo['RTE_ORIG_ID'], true); // Return the relative path of the copy file name: return PathUtility::stripPathSitePrefix($copyDestName); - } else { - $this->error('ERROR: Could not find original file ID'); } + $this->error('ERROR: Could not find original file ID'); } else { $this->error('ERROR: The destination filenames "' . $copyDestName . '" and "' . $origDestName . '" either existed or have non-valid names'); } @@ -1617,10 +1614,9 @@ class Import extends ImportExport $this->fileIDMap[$fileID] = $fileName; if (md5(file_get_contents($fileName)) == $this->dat['files'][$fileID]['content_md5']) { return true; - } else { - $this->error('ERROR: File content "' . $fileName . '" was corrupted'); - return false; } + $this->error('ERROR: File content "' . $fileName . '" was corrupted'); + return false; } /** @@ -1692,9 +1688,8 @@ class Import extends ImportExport if ($this->dat['_DOCUMENT_TAG'] === 'T3RecordDocument' && is_array($this->dat['header']) && is_array($this->dat['records'])) { $this->loadInit(); return true; - } else { - $this->error('XML file did not contain proper XML for TYPO3 Import'); } + $this->error('XML file did not contain proper XML for TYPO3 Import'); } else { $this->error('XML could not be parsed: ' . $this->dat); } @@ -1712,9 +1707,9 @@ class Import extends ImportExport } $this->loadInit(); return true; - } else { - $this->error('Error opening file: ' . $filename); } + $this->error('Error opening file: ' . $filename); + fclose($fd); } return false; @@ -1760,9 +1755,9 @@ class Import extends ImportExport } } return $unserialize ? unserialize($datString, ['allowed_classes' => false]) : $datString; - } else { - $this->error('MD5 check failed (' . $name . ')'); } + $this->error('MD5 check failed (' . $name . ')'); + return null; } @@ -1808,9 +1803,8 @@ class Import extends ImportExport if ($this->compress) { $datString = gzuncompress($datString); return $unserialize ? unserialize($datString, ['allowed_classes' => false]) : $datString; - } else { - $this->error('Content read error: This file requires decompression, but this server does not offer gzcompress()/gzuncompress() functions.'); } + $this->error('Content read error: This file requires decompression, but this server does not offer gzcompress()/gzuncompress() functions.'); } } else { $this->error('MD5 check failed (' . $name . ')'); diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php index 95f584aae389d41eaa2ad1a389e6550a30033b19..8232b0a0ddfd22a6fb3b304aed4376e127e2c46c 100644 --- a/typo3/sysext/impexp/Classes/ImportExport.php +++ b/typo3/sysext/impexp/Classes/ImportExport.php @@ -854,21 +854,20 @@ abstract class ImportExport if ($this->mode === 'export') { if ($r['type'] === 'record') { return '<input type="checkbox" class="t3js-exclude-checkbox" name="tx_impexp[exclude][' . $r['ref'] . ']" id="checkExclude' . $r['ref'] . '" value="1" /> <label for="checkExclude' . $r['ref'] . '">' . htmlspecialchars($this->getLanguageService()->getLL('impexpcore_singlereco_exclude')) . '</label>'; - } else { - return $r['type'] === 'softref' ? $this->softrefSelector($r['_softRefInfo']) : ''; } - } else { - // During import - // For softreferences with editable fields: - if ($r['type'] === 'softref' && is_array($r['_softRefInfo']['subst']) && $r['_softRefInfo']['subst']['tokenID']) { - $tokenID = $r['_softRefInfo']['subst']['tokenID']; - $cfg = $this->softrefCfg[$tokenID]; - if ($cfg['mode'] === 'editable') { - return (strlen($cfg['title']) ? '<strong>' . htmlspecialchars($cfg['title']) . '</strong><br/>' : '') . htmlspecialchars($cfg['description']) . '<br/> + return $r['type'] === 'softref' ? $this->softrefSelector($r['_softRefInfo']) : ''; + } + // During import + // For softreferences with editable fields: + if ($r['type'] === 'softref' && is_array($r['_softRefInfo']['subst']) && $r['_softRefInfo']['subst']['tokenID']) { + $tokenID = $r['_softRefInfo']['subst']['tokenID']; + $cfg = $this->softrefCfg[$tokenID]; + if ($cfg['mode'] === 'editable') { + return (strlen($cfg['title']) ? '<strong>' . htmlspecialchars($cfg['title']) . '</strong><br/>' : '') . htmlspecialchars($cfg['description']) . '<br/> <input type="text" name="tx_impexp[softrefInputValues][' . $tokenID . ']" value="' . htmlspecialchars((isset($this->softrefInputValues[$tokenID]) ? $this->softrefInputValues[$tokenID] : $cfg['defValue'])) . '" />'; - } } } + return ''; } diff --git a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php index d011ffe793552316d49216ba39df6decb07a39e1..87fa243f2d09897aad4c872e37fdc01a69c18f82 100644 --- a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php +++ b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php @@ -298,10 +298,9 @@ class IndexSearchRepository 'firstRow' => $firstRow, 'count' => $count ]; - } else { - // No results found - return false; } + // No results found + return false; } /** @@ -323,9 +322,8 @@ class IndexSearchRepository $res = $this->execFinalQuery($list, $freeIndexUid); $this->getTimeTracker()->pull(); return $res; - } else { - return false; } + return false; } /** @@ -1186,17 +1184,17 @@ class IndexSearchRepository 'gr_list' => $this->frontendUserGroupList ] ); - } else { - // Ordinary TYPO3 pages: - if ((string)$row['gr_list'] !== (string)$this->frontendUserGroupList) { - // Selecting for the grlist records belonging to the phash-row where the current users gr_list exists. - // If it is found it is proof that this user has direct access to the phash-rows content although - // he did not himself initiate the indexing... - if (!$this->isTableUsed('index_grlist')) { - return false; - } + } + // Ordinary TYPO3 pages: + if ((string)$row['gr_list'] !== (string)$this->frontendUserGroupList) { + // Selecting for the grlist records belonging to the phash-row where the current users gr_list exists. + // If it is found it is proof that this user has direct access to the phash-rows content although + // he did not himself initiate the indexing... + if (!$this->isTableUsed('index_grlist')) { + return false; + } - return (bool)$connection->count( + return (bool)$connection->count( 'phash', 'index_grlist', [ @@ -1204,10 +1202,8 @@ class IndexSearchRepository 'gr_list' => $this->frontendUserGroupList ] ); - } else { - return true; - } } + return true; } /** diff --git a/typo3/sysext/indexed_search/Classes/Indexer.php b/typo3/sysext/indexed_search/Classes/Indexer.php index daeab9ac9d6499dbd2392b441696100755a8172a..8c2882ebf4aee8fb237446383271ab23e3e903e5 100644 --- a/typo3/sysext/indexed_search/Classes/Indexer.php +++ b/typo3/sysext/indexed_search/Classes/Indexer.php @@ -741,9 +741,8 @@ class Indexer } } return true; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/indexed_search/Classes/Lexer.php b/typo3/sysext/indexed_search/Classes/Lexer.php index 6bb8328b55c5548dae757ec6c79f8b127c6d164e..a926ab5c0fa7dbff8860c6f1ceeae701fc7781bd 100644 --- a/typo3/sysext/indexed_search/Classes/Lexer.php +++ b/typo3/sysext/indexed_search/Classes/Lexer.php @@ -215,11 +215,10 @@ class Lexer $len = $printJoinLgd; } return true; - } else { - // If a printJoin char is found, record the length if it has not been recorded already: - if (!$printJoinLgd) { - $printJoinLgd = $len; - } + } + // If a printJoin char is found, record the length if it has not been recorded already: + if (!$printJoinLgd) { + $printJoinLgd = $len; } } else { // When a true letter is found, reset printJoinLgd counter: diff --git a/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php b/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php index be03aee6a889c0e5a87130ca9a1b394a1721cbc6..0c665f287a3876d473050dc0a6dd74ca93a41293 100644 --- a/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php +++ b/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php @@ -221,13 +221,12 @@ class DoubleMetaPhoneUtility } $this->current += 3; break; - } else { - // Pierce's rule - $this->primary .= 'K'; - $this->secondary .= 'K'; - $this->current += 2; - break; } + // Pierce's rule + $this->primary .= 'K'; + $this->secondary .= 'K'; + $this->current += 2; + break; } if ($this->StringAt($this->original, $this->current, 2, ['CK', 'CG', 'CQ'])) { $this->primary .= 'K'; @@ -269,13 +268,12 @@ class DoubleMetaPhoneUtility $this->secondary .= 'J'; $this->current += 3; break; - } else { - // e.g. 'edgar' - $this->primary .= 'TK'; - $this->secondary .= 'TK'; - $this->current += 2; - break; } + // e.g. 'edgar' + $this->primary .= 'TK'; + $this->secondary .= 'TK'; + $this->current += 2; + break; } if ($this->StringAt($this->original, $this->current, 2, ['DT', 'DD'])) { $this->primary .= 'T'; @@ -323,18 +321,17 @@ class DoubleMetaPhoneUtility if ($this->current > 1 && $this->StringAt($this->original, $this->current - 2, 1, ['B', 'H', 'D']) || $this->current > 2 && $this->StringAt($this->original, $this->current - 3, 1, ['B', 'H', 'D']) || $this->current > 3 && $this->StringAt($this->original, $this->current - 4, 1, ['B', 'H'])) { $this->current += 2; break; - } else { - // e.g. 'laugh', 'McLaughlin', 'cough', 'gough', 'rough', 'tough' - if ($this->current > 2 && substr($this->original, $this->current - 1, 1) === 'U' && $this->StringAt($this->original, $this->current - 3, 1, ['C', 'G', 'L', 'R', 'T'])) { - $this->primary .= 'F'; - $this->secondary .= 'F'; - } elseif ($this->current > 0 && substr($this->original, $this->current - 1, 1) !== 'I') { - $this->primary .= 'K'; - $this->secondary .= 'K'; - } - $this->current += 2; - break; } + // e.g. 'laugh', 'McLaughlin', 'cough', 'gough', 'rough', 'tough' + if ($this->current > 2 && substr($this->original, $this->current - 1, 1) === 'U' && $this->StringAt($this->original, $this->current - 3, 1, ['C', 'G', 'L', 'R', 'T'])) { + $this->primary .= 'F'; + $this->secondary .= 'F'; + } elseif ($this->current > 0 && substr($this->original, $this->current - 1, 1) !== 'I') { + $this->primary .= 'K'; + $this->secondary .= 'K'; + } + $this->current += 2; + break; } if (substr($this->original, $this->current + 1, 1) === 'N') { if ($this->current == 1 && $this->IsVowel($this->original, 0) && !$this->SlavoGermanic($this->original)) { @@ -616,17 +613,16 @@ class DoubleMetaPhoneUtility } $this->current += 3; break; + } + if ($this->current == 0 && !$this->IsVowel($this->original, 3) && substr($this->original, $this->current + 3, 1) !== 'W') { + $this->primary .= 'X'; + $this->secondary .= 'S'; } else { - if ($this->current == 0 && !$this->IsVowel($this->original, 3) && substr($this->original, $this->current + 3, 1) !== 'W') { - $this->primary .= 'X'; - $this->secondary .= 'S'; - } else { - $this->primary .= 'X'; - $this->secondary .= 'X'; - } - $this->current += 3; - break; + $this->primary .= 'X'; + $this->secondary .= 'X'; } + $this->current += 3; + break; } if ($this->StringAt($this->original, $this->current + 2, 1, ['I', 'E', 'Y'])) { $this->primary .= 'S'; @@ -751,7 +747,8 @@ class DoubleMetaPhoneUtility $this->secondary .= 'J'; $this->current += 2; break; - } elseif ($this->StringAt($this->original, $this->current + 1, 2, ['ZO', 'ZI', 'ZA']) || $this->SlavoGermanic($this->original) && ($this->current > 0 && substr($this->original, $this->current - 1, 1) !== 'T')) { + } + if ($this->StringAt($this->original, $this->current + 1, 2, ['ZO', 'ZI', 'ZA']) || $this->SlavoGermanic($this->original) && ($this->current > 0 && substr($this->original, $this->current - 1, 1) !== 'T')) { $this->primary .= 'S'; $this->secondary .= 'TS'; } else { diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php index 81f6da8a2df61b9896127c39dbbf4cd82f0ef396..ef517421794e521da2a6f8576c0c5bbac99deb1d 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php +++ b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionCompatibilityTester.php @@ -125,9 +125,8 @@ class ExtensionCompatibilityTester extends AbstractAjaxAction if (is_file($this->protocolFile)) { $exclude = (string)file_get_contents($this->protocolFile); return GeneralUtility::trimExplode(',', $exclude); - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php b/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php index 46df25c9a123fb2052274e7ccf0d24a60ae5a367..d8f5bbde8e79f6211a4b12b3e498078b48a6cd24 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php @@ -86,9 +86,8 @@ class EnvironmentAndFolders extends AbstractStepAction { if (@is_file(PATH_typo3conf . 'LocalConfiguration.php')) { return false; - } else { - return true; } + return true; } /** diff --git a/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php b/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php index 99a6314a88ab0159286b03221c9676dc4b1e815a..6686236e7a6502f9aadab22408898842858bee6b 100644 --- a/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php @@ -127,9 +127,8 @@ abstract class AbstractNode { if (@is_link($this->getAbsolutePath())) { return true; - } else { - return @file_exists($this->getAbsolutePath()); } + return @file_exists($this->getAbsolutePath()); } /** @@ -173,9 +172,8 @@ abstract class AbstractNode } if ($this->getCurrentPermission() === $this->getTargetPermission()) { return true; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/install/Classes/Service/EnableFileService.php b/typo3/sysext/install/Classes/Service/EnableFileService.php index f529da5935720194b806b0b3cf23c554ef438529..9e3bf9780371e8e20c050460eb02c26e0846b48a 100644 --- a/typo3/sysext/install/Classes/Service/EnableFileService.php +++ b/typo3/sysext/install/Classes/Service/EnableFileService.php @@ -151,9 +151,8 @@ class EnableFileService { if (time() - @filemtime(self::getInstallToolEnableFilePath()) > self::INSTALL_TOOL_ENABLE_FILE_LIFETIME) { return true; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/install/Classes/Service/SessionService.php b/typo3/sysext/install/Classes/Service/SessionService.php index 470a5259947ec48b0b2ac490496c9528d1738d64..de387b2df64c2aaab00d9194c5a5b9cfc95777a7 100644 --- a/typo3/sysext/install/Classes/Service/SessionService.php +++ b/typo3/sysext/install/Classes/Service/SessionService.php @@ -82,7 +82,8 @@ class SessionService implements \TYPO3\CMS\Core\SingletonInterface $sessionCreationError .= 'The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:<br />'; $sessionCreationError .= '<pre>php_value session.auto_start Off</pre>'; throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587485); - } elseif (defined('SID')) { + } + if (defined('SID')) { $sessionCreationError = 'Session already started by session_start().<br />'; $sessionCreationError .= 'Make sure no installed extension is starting a session in its ext_localconf.php or ext_tables.php.'; throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587486); diff --git a/typo3/sysext/install/Classes/SystemEnvironment/Check.php b/typo3/sysext/install/Classes/SystemEnvironment/Check.php index 596a8f3a8b069bcdc8b18ed869d1b6144b5c4bf1..2f2d1edc56e84b0f851a88e7c9d0bbdb8159d8fc 100644 --- a/typo3/sysext/install/Classes/SystemEnvironment/Check.php +++ b/typo3/sysext/install/Classes/SystemEnvironment/Check.php @@ -609,9 +609,8 @@ class Check implements CheckInterface $status = new Status\OkStatus(); $status->setTitle('PHP suhosin extension loaded and active'); return $status; - } else { - throw new \BadMethodCallException('Should be called only if suhosin extension is loaded', 1422634778); } + throw new \BadMethodCallException('Should be called only if suhosin extension is loaded', 1422634778); } /** diff --git a/typo3/sysext/install/Classes/Updates/AbstractUpdate.php b/typo3/sysext/install/Classes/Updates/AbstractUpdate.php index a2eae36fefff4264b721f40ad72bc1e2303ed20d..1cac4c4e5b97fb0f0da40167521d20e26996c553 100644 --- a/typo3/sysext/install/Classes/Updates/AbstractUpdate.php +++ b/typo3/sysext/install/Classes/Updates/AbstractUpdate.php @@ -54,9 +54,8 @@ abstract class AbstractUpdate { if ($this->title) { return $this->title; - } else { - return $this->identifier; } + return $this->identifier; } /** diff --git a/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php b/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php index 8ad2ca9d0ac2a75627a310fd7e22082249323817..aab808e47746a8c74ec3f1faef538fe5da4cdfa6 100644 --- a/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php +++ b/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php @@ -137,9 +137,8 @@ class DatabaseRowsUpdateWizard extends AbstractUpdate foreach ($listOfAllTables as $key => $table) { if ($table === $startPosition['table']) { break; - } else { - unset($listOfAllTables[$key]); } + unset($listOfAllTables[$key]); } // Ask each row updater if it potentially has field updates for rows of a table diff --git a/typo3/sysext/lang/Classes/Service/TerService.php b/typo3/sysext/lang/Classes/Service/TerService.php index c206abb01802ae57177c75af75539877b1835c89..2ac9757c499dcedb0ee1d7d1434e3fdbbbc20d80 100644 --- a/typo3/sysext/lang/Classes/Service/TerService.php +++ b/typo3/sysext/lang/Classes/Service/TerService.php @@ -74,22 +74,22 @@ class TerService extends TerUtility implements SingletonInterface $error = xml_error_string(xml_get_error_code($parser)); xml_parser_free($parser); throw new XmlParserException('Error in XML parser while decoding l10n XML file. Line ' . $line . ': ' . $error, 1345736517); - } else { - // Init vars - $stack = [[]]; - $stacktop = 0; - $current = []; - $tagName = ''; - $documentTag = ''; - // Traverse the parsed XML structure: - foreach ($values as $val) { - // First, process the tag-name (which is used in both cases, whether "complete" or "close") - $tagName = (string)($val['tag'] === 'languagepack' && $val['type'] === 'open') ? $val['attributes']['language'] : $val['tag']; - if (!$documentTag) { - $documentTag = $tagName; - } - // Setting tag-values, manage stack: - switch ($val['type']) { + } + // Init vars + $stack = [[]]; + $stacktop = 0; + $current = []; + $tagName = ''; + $documentTag = ''; + // Traverse the parsed XML structure: + foreach ($values as $val) { + // First, process the tag-name (which is used in both cases, whether "complete" or "close") + $tagName = (string)($val['tag'] === 'languagepack' && $val['type'] === 'open') ? $val['attributes']['language'] : $val['tag']; + if (!$documentTag) { + $documentTag = $tagName; + } + // Setting tag-values, manage stack: + switch ($val['type']) { // If open tag it means there is an array stored in sub-elements. // Therefore increase the stackpointer and reset the accumulation array case 'open': @@ -115,9 +115,9 @@ class TerService extends TerUtility implements SingletonInterface } break; } - } - $result = $current[$tagName]; } + $result = $current[$tagName]; + return $result; } @@ -193,9 +193,8 @@ class TerService extends TerUtility implements SingletonInterface $l10nResponse = GeneralUtility::getUrl($mirrorUrl . $packageUrl); if ($l10nResponse === false) { throw new XmlParserException('Error: Translation could not be fetched.', 1345736785); - } else { - return [$l10nResponse]; } + return [$l10nResponse]; } /** diff --git a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php index e4f7b5d4c7aa825c3dec11fd3d8a8420c1fabe4a..b3c0cc0e6a7186b731c076b61b0cfdf45a70fe3f 100644 --- a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php +++ b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php @@ -504,9 +504,8 @@ class ValidatorTask extends AbstractTask $lang->sL($this->languageFile . ':tasks.error.invalidToEmail'), '1295476821' ); - } else { - $validEmailList[] = $emailAdd; } + $validEmailList[] = $emailAdd; } } if (is_array($validEmailList) && !empty($validEmailList)) { diff --git a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php index d87bb0e0657ef2be00697bec1bec38fe636718ad..929bf62c03ef13f5d81d58bad58a8511444b4913 100644 --- a/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php +++ b/typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php @@ -292,9 +292,8 @@ class ValidatorTaskAdditionalFieldProvider implements AdditionalFieldProviderInt $page = BackendUtility::getRecord('pages', $pageId, 'title', '', false); if ($page === null) { return ''; - } else { - return $page['title']; } + return $page['title']; } /** diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/FolderLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/FolderLinkHandler.php index d2fd06ef0357efb9e6db2d40d9a91378d88dd3bd..07e7962d4fb292187398a1e0f1a1dd73a0aaf2d9 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/FolderLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/FolderLinkHandler.php @@ -56,9 +56,8 @@ class FolderLinkHandler extends FileLinkHandler return [ 'data-current-link' => GeneralUtility::makeInstance(LinkService::class)->asString(['type' => LinkService::TYPE_FOLDER, 'folder' => $this->linkParts['url']['folder']]) ]; - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php index 3bf396c8cf6f345daaece1d285a5b2c4fdb2ff59..2999fdde51037c391ccb8134c1356b478fa1837a 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php @@ -215,9 +215,8 @@ class PageLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac { if ((int)$this->getBackendUser()->getSessionData('pageTree_temporaryMountPoint') > 0) { return GeneralUtility::linkThisScript(['setTempDBmount' => 0]); - } else { - return ''; } + return ''; } /** diff --git a/typo3/sysext/recycler/Classes/Task/CleanerFieldProvider.php b/typo3/sysext/recycler/Classes/Task/CleanerFieldProvider.php index a7af82faf874570c1df880fc944b85511330dff2..fdb2f78c7b77dbf822ec116f9a3ca0f70062132b 100644 --- a/typo3/sysext/recycler/Classes/Task/CleanerFieldProvider.php +++ b/typo3/sysext/recycler/Classes/Task/CleanerFieldProvider.php @@ -152,9 +152,8 @@ class CleanerFieldProvider implements \TYPO3\CMS\Scheduler\AdditionalFieldProvid FlashMessage::ERROR ); break; - } else { - $checkTca = true; } + $checkTca = true; } return $checkTca; diff --git a/typo3/sysext/saltedpasswords/Classes/Task/BulkUpdateTask.php b/typo3/sysext/saltedpasswords/Classes/Task/BulkUpdateTask.php index 0cc87c19358070675070e66f43535342f16c1784..5c22fbdaa93eabb6a9e4c9bd71c1b6708356d8bf 100644 --- a/typo3/sysext/saltedpasswords/Classes/Task/BulkUpdateTask.php +++ b/typo3/sysext/saltedpasswords/Classes/Task/BulkUpdateTask.php @@ -294,13 +294,13 @@ class BulkUpdateTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask $mode = strtolower($mode); if ($mode === 'be') { return 'be_users'; - } elseif ($mode === 'fe') { + } + if ($mode === 'fe') { return 'fe_users'; - } else { - throw new \InvalidArgumentException( + } + throw new \InvalidArgumentException( 'Invalid mode "' . $mode . '" for salted passwords bulk update', 1465392861 ); - } } } diff --git a/typo3/sysext/saltedpasswords/Classes/Utility/SaltedPasswordsUtility.php b/typo3/sysext/saltedpasswords/Classes/Utility/SaltedPasswordsUtility.php index d24eab8874f5fe62da0524cd40f34349cee61164..b5f2e983e5bce756aecd5026febb9df0d153489d 100644 --- a/typo3/sysext/saltedpasswords/Classes/Utility/SaltedPasswordsUtility.php +++ b/typo3/sysext/saltedpasswords/Classes/Utility/SaltedPasswordsUtility.php @@ -131,7 +131,8 @@ class SaltedPasswordsUtility $securityLevel = trim($GLOBALS['TYPO3_CONF_VARS'][$mode]['loginSecurityLevel']) ?: 'normal'; if ($mode === 'BE') { return true; - } elseif ($mode === 'FE' && $extConf['enabled']) { + } + if ($mode === 'FE' && $extConf['enabled']) { return $securityLevel === 'normal' || $securityLevel === 'rsa'; } return false; diff --git a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php index fa073b124412fe1f48de681b8c67eaa8cb493bc6..c55ca00b302d743adb817431d56331f134ccff87 100644 --- a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php +++ b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php @@ -837,9 +837,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas )->render() . '</span> </span> </a><span id="page_' . $fieldID . '"> ' . htmlspecialchars($fieldInfo['pageTitle']) . '</span></div>'; - } else { - return ''; } + return ''; } /** diff --git a/typo3/sysext/scheduler/Classes/Scheduler.php b/typo3/sysext/scheduler/Classes/Scheduler.php index f59d8c127f6baa409b7ea0b543f17323136ac636..b0684a38e958a5b8108125eb976af79a783735fb 100644 --- a/typo3/sysext/scheduler/Classes/Scheduler.php +++ b/typo3/sysext/scheduler/Classes/Scheduler.php @@ -336,27 +336,28 @@ class Scheduler implements \TYPO3\CMS\Core\SingletonInterface $row = $queryBuilder->execute()->fetch(); if ($row === false) { throw new \OutOfBoundsException('Query could not be executed. Possible defect in tables tx_scheduler_task or tx_scheduler_task_group or DB server problems', 1422044826); - } elseif (empty($row)) { + } + if (empty($row)) { // If there are no available tasks, thrown an exception throw new \OutOfBoundsException('No task', 1247827244); + } + /** @var $task Task\AbstractTask */ + $task = unserialize($row['serialized_task_object']); + if ($this->isValidTaskObject($task)) { + // The task is valid, return it + $task->setScheduler(); } else { - /** @var $task Task\AbstractTask */ - $task = unserialize($row['serialized_task_object']); - if ($this->isValidTaskObject($task)) { - // The task is valid, return it - $task->setScheduler(); - } else { - // Forcibly set the disable flag to 1 in the database, - // so that the task does not come up again and again for execution - $connectionPool->getConnectionForTable('tx_scheduler_task')->update( + // Forcibly set the disable flag to 1 in the database, + // so that the task does not come up again and again for execution + $connectionPool->getConnectionForTable('tx_scheduler_task')->update( 'tx_scheduler_task', ['disable' => 1], ['uid' => (int)$row['uid']] ); - // Throw an exception to raise the problem - throw new \UnexpectedValueException('Could not unserialize task', 1255083671); - } + // Throw an exception to raise the problem + throw new \UnexpectedValueException('Could not unserialize task', 1255083671); } + return $task; } diff --git a/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionAdditionalFieldProvider.php b/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionAdditionalFieldProvider.php index 0c573ec0da4c09253b56b1ff6eea6fbbbe4871be..4475581218ffe7cb460c805784300a3a58f87947 100644 --- a/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionAdditionalFieldProvider.php +++ b/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionAdditionalFieldProvider.php @@ -158,9 +158,11 @@ class FileStorageExtractionAdditionalFieldProvider implements AdditionalFieldPro || !MathUtility::canBeInterpretedAsInteger($submittedData['scheduler_fileStorageIndexing_fileCount']) ) { return false; - } elseif (ResourceFactory::getInstance()->getStorageObject($submittedData['scheduler_fileStorageIndexing_storage']) === null) { + } + if (ResourceFactory::getInstance()->getStorageObject($submittedData['scheduler_fileStorageIndexing_storage']) === null) { return false; - } elseif (!MathUtility::isIntegerInRange($submittedData['scheduler_fileStorageIndexing_fileCount'], 1, 9999)) { + } + if (!MathUtility::isIntegerInRange($submittedData['scheduler_fileStorageIndexing_fileCount'], 1, 9999)) { return false; } return true; diff --git a/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingAdditionalFieldProvider.php b/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingAdditionalFieldProvider.php index 3f870fbe2e1dbda6c23c93a0f1381665ef445e45..8a33bd91f788b8689c05a227b927e9e0e33001e3 100644 --- a/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingAdditionalFieldProvider.php +++ b/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingAdditionalFieldProvider.php @@ -84,7 +84,8 @@ class FileStorageIndexingAdditionalFieldProvider implements \TYPO3\CMS\Scheduler $value = $submittedData['scheduler_fileStorageIndexing_storage']; if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($value)) { return false; - } elseif (\TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject($submittedData['scheduler_fileStorageIndexing_storage']) !== null) { + } + if (\TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject($submittedData['scheduler_fileStorageIndexing_storage']) !== null) { return true; } return false; diff --git a/typo3/sysext/sys_action/Classes/ActionTask.php b/typo3/sysext/sys_action/Classes/ActionTask.php index c55f7bb0813819167a8a44284e059627dfda19af..f771a0048a00171c5e59c9bd4bc56591f7e8ea6f 100644 --- a/typo3/sysext/sys_action/Classes/ActionTask.php +++ b/typo3/sysext/sys_action/Classes/ActionTask.php @@ -450,9 +450,8 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface $record = BackendUtility::getRecord('be_users', $id, '*', ' AND cruser_id=' . $this->getBackendUser()->user['uid'] . ' AND createdByAction=' . $action['uid']); if (is_array($record)) { return $record; - } else { - return false; } + return false; } /** diff --git a/typo3/sysext/version/Classes/Dependency/ElementEntity.php b/typo3/sysext/version/Classes/Dependency/ElementEntity.php index a2bb594068abca7d193c5772ee38eccc1774bdcf..f6a4811c828a5ca781aea1efb39741d3932b9ba1 100644 --- a/typo3/sysext/version/Classes/Dependency/ElementEntity.php +++ b/typo3/sysext/version/Classes/Dependency/ElementEntity.php @@ -367,7 +367,8 @@ class ElementEntity if ($outerMostParent instanceof \TYPO3\CMS\Version\Dependency\ElementEntity) { $this->outerMostParent = $outerMostParent; break; - } elseif ($outerMostParent === false) { + } + if ($outerMostParent === false) { break; } } diff --git a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php index 83af9e6ab687ce66f15ffb95bf71a7652f8053bb..8c2725e1bc6a954897e4fe3907b2df80716c913d 100644 --- a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php +++ b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php @@ -197,9 +197,8 @@ class ViewModuleController extends ActionController } } return $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand . $languageParameter; - } else { - return '#'; } + return '#'; } /** diff --git a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php index e2e17c2070d47f7dc6eaab24096134c3f5be0251..08a36ed830c4b4ee5fba7b991cd3bd3d917d4265 100644 --- a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php +++ b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php @@ -205,9 +205,8 @@ class ActionHandler extends AbstractHandler { if (is_array($GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['columns'])) { return $GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['columns']; - } else { - return []; } + return []; } /** diff --git a/typo3/sysext/workspaces/Classes/Domain/Record/StageRecord.php b/typo3/sysext/workspaces/Classes/Domain/Record/StageRecord.php index f156edc089c828ab9f967c8d7b34d0d4248d3910..f9dbea743af1cf678a27b9ac57da684becad59f6 100644 --- a/typo3/sysext/workspaces/Classes/Domain/Record/StageRecord.php +++ b/typo3/sysext/workspaces/Classes/Domain/Record/StageRecord.php @@ -119,9 +119,11 @@ class StageRecord extends AbstractRecord { if ($this->getUid() === $stageRecord->getUid()) { return 0; - } elseif ($this->isEditStage() || $stageRecord->isExecuteStage() || $this->isPreviousTo($stageRecord)) { + } + if ($this->isEditStage() || $stageRecord->isExecuteStage() || $this->isPreviousTo($stageRecord)) { return -1; - } elseif ($this->isExecuteStage() || $stageRecord->isEditStage() || $this->isNextTo($stageRecord)) { + } + if ($this->isExecuteStage() || $stageRecord->isEditStage() || $this->isNextTo($stageRecord)) { return 1; } return 0; diff --git a/typo3/sysext/workspaces/Classes/Hook/PreviewHook.php b/typo3/sysext/workspaces/Classes/Hook/PreviewHook.php index a4c5e96fb0090256ac5c821e7b11f9cb74a424a8..6fe3718c8ea11f96f11c36c6984478dc45ecb647 100644 --- a/typo3/sysext/workspaces/Classes/Hook/PreviewHook.php +++ b/typo3/sysext/workspaces/Classes/Hook/PreviewHook.php @@ -303,26 +303,24 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface setcookie($this->previewKey, GeneralUtility::_GP($this->previewKey), 0, GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), null, null, true); } return $previewConfig; - } elseif (GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode === GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) { + } + if (GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode === GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) { // Set GET variables $GET_VARS = ''; parse_str($previewConfig['getVars'], $GET_VARS); GeneralUtility::_GETset($GET_VARS); // Return preview keyword configuration return $previewConfig; - } else { - // This check is to prevent people from setting additional - // GET vars via realurl or other URL path based ways of passing parameters. - throw new \Exception(htmlspecialchars('Request URL did not match "' + } + // This check is to prevent people from setting additional + // GET vars via realurl or other URL path based ways of passing parameters. + throw new \Exception(htmlspecialchars('Request URL did not match "' . GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?' . $this->previewKey . '=' . $inputCode . '"', 1294585190)); - } - } else { - throw new \Exception('POST requests are incompatible with keyword preview.', 1294585191); } - } else { - throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192); + throw new \Exception('POST requests are incompatible with keyword preview.', 1294585191); } + throw new \Exception('ADMCMD command could not be executed! (No keyword configuration found)', 1294585192); } return false; } diff --git a/typo3/sysext/workspaces/Classes/Service/GridDataService.php b/typo3/sysext/workspaces/Classes/Service/GridDataService.php index a80240ec02ac2fca54350f2b9b011c61e24bd768..09068a01a05e7aa57f6050d9f62d10da8ab701f2 100644 --- a/typo3/sysext/workspaces/Classes/Service/GridDataService.php +++ b/typo3/sysext/workspaces/Classes/Service/GridDataService.php @@ -395,13 +395,15 @@ class GridDataService $path_cmp = strcasecmp($a['path_Workspace'], $b['path_Workspace']); if ($path_cmp < 0) { return $path_cmp; - } elseif ($path_cmp == 0) { + } + if ($path_cmp == 0) { if ($a[$this->sort] == $b[$this->sort]) { return 0; } if ($this->sortDir === 'ASC') { return $a[$this->sort] < $b[$this->sort] ? -1 : 1; - } elseif ($this->sortDir === 'DESC') { + } + if ($this->sortDir === 'DESC') { return $a[$this->sort] > $b[$this->sort] ? -1 : 1; } } elseif ($path_cmp > 0) { @@ -425,13 +427,15 @@ class GridDataService $path_cmp = strcasecmp($a['path_Workspace'], $b['path_Workspace']); if ($path_cmp < 0) { return $path_cmp; - } elseif ($path_cmp == 0) { + } + if ($path_cmp == 0) { if ($a[$this->sort] == $b[$this->sort]) { return 0; } if ($this->sortDir === 'ASC') { return strcasecmp($a[$this->sort], $b[$this->sort]); - } elseif ($this->sortDir === 'DESC') { + } + if ($this->sortDir === 'DESC') { return strcasecmp($a[$this->sort], $b[$this->sort]) * -1; } } elseif ($path_cmp > 0) { diff --git a/typo3/sysext/workspaces/Classes/Service/IntegrityService.php b/typo3/sysext/workspaces/Classes/Service/IntegrityService.php index 1c833bbffd7f71c457695a130609ea08f3ef294b..fbb89e8f10e7e3027edfdc9c4bdd2d227bd45864 100644 --- a/typo3/sysext/workspaces/Classes/Service/IntegrityService.php +++ b/typo3/sysext/workspaces/Classes/Service/IntegrityService.php @@ -188,7 +188,8 @@ class IntegrityService { if ($identifier === null) { return $this->issues; - } elseif (isset($this->issues[$identifier])) { + } + if (isset($this->issues[$identifier])) { return $this->issues[$identifier]; } return []; diff --git a/typo3/sysext/workspaces/Classes/Service/StagesService.php b/typo3/sysext/workspaces/Classes/Service/StagesService.php index c4270b4cc76a5c11d8af3ca3b7e59c03d9addebc..4d41cf87c8d1c4fc95b3b9da553af7a89673eeff 100644 --- a/typo3/sysext/workspaces/Classes/Service/StagesService.php +++ b/typo3/sysext/workspaces/Classes/Service/StagesService.php @@ -347,24 +347,21 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface // Current stage is "Ready to publish" - there is no next stage if ($stageId == self::STAGE_PUBLISH_ID) { return $nextStageArray; - } else { - $nextStageRecord = $this->getNextStage($stageId); - if (empty($nextStageRecord) || !is_array($nextStageRecord)) { - // There is no next stage - return $nextStageArray; - } else { - // Check if the user has the permission to for the current stage - // If this next stage record is the first next stage after the current the user - // has always the needed permission - if ($this->isStageAllowedForUser($stageId)) { - $nextStageArray[] = $nextStageRecord; - return $this->getNextStages($nextStageArray, $nextStageRecord['uid']); - } else { - // He hasn't - return given next stage array - return $nextStageArray; - } - } } + $nextStageRecord = $this->getNextStage($stageId); + if (empty($nextStageRecord) || !is_array($nextStageRecord)) { + // There is no next stage + return $nextStageArray; + } + // Check if the user has the permission to for the current stage + // If this next stage record is the first next stage after the current the user + // has always the needed permission + if ($this->isStageAllowedForUser($stageId)) { + $nextStageArray[] = $nextStageRecord; + return $this->getNextStages($nextStageArray, $nextStageRecord['uid']); + } + // He hasn't - return given next stage array + return $nextStageArray; } /** @@ -394,8 +391,8 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface } prev($workspaceStageRecs); } - } else { } + return $prevStage; } @@ -543,9 +540,8 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface $stageRecord->getPreselectedRecipients(), $this->getRecordService()->getCreateUserIds() ); - } else { - return $stageRecord->getPreselectedRecipients(); } + return $stageRecord->getPreselectedRecipients(); } /** diff --git a/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php b/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php index 9515e01c2b43a86ff48d91e36459e354a2ab895e..f03a1c48d53945b61145e5916e8c985062985737 100644 --- a/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php +++ b/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php @@ -276,7 +276,8 @@ class WorkspaceService implements SingletonInterface // be collected, an empty result array needs to be returned: if ($isTableLocalizable === false && $language > 0) { return []; - } elseif ($isTableLocalizable) { + } + if ($isTableLocalizable) { $languageParentField = 'A.' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']; } @@ -868,9 +869,8 @@ class WorkspaceService implements SingletonInterface GeneralUtility::_GETset($originalM, 'M'); if ($addDomain === true) { return BackendUtility::getViewDomain($uid) . $redirect . urlencode($viewScript) . $uid; - } else { - return $viewScript; } + return $viewScript; } /**