From 4e457d36ccf276839faa5829bd22011f041d54e8 Mon Sep 17 00:00:00 2001 From: Wouter Wolters <typo3@wouterwolters.nl> Date: Wed, 23 Aug 2017 18:45:54 +0200 Subject: [PATCH] [TASK] Update php-cs-fixer to 2.5.0 Add 2 new rules * no_superfluous_elseif * no_useless_else Both rules only apply if the if-statement contains a return. If this is the case the obsolete else/elseif part is dropped. Resolves: #82183 Releases: master,8.7 Change-Id: I94dfa6b5b96cbc3e350bd778f1796dda1a4d955a Reviewed-on: https://review.typo3.org/53791 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org> --- Build/.php_cs | 4 +- composer.lock | 18 +-- .../ToolbarItems/ClearCacheToolbarItem.php | 11 +- .../ToolbarItems/ShortcutToolbarItem.php | 3 +- .../ConditionMatching/ConditionMatcher.php | 6 +- .../Classes/Controller/BackendController.php | 3 +- .../NewContentElementController.php | 9 +- .../Controller/EditDocumentController.php | 28 ++-- .../Controller/File/FileController.php | 5 +- .../Classes/Controller/LoginController.php | 5 +- .../Controller/NewRecordController.php | 5 +- .../Page/NewMultiplePagesController.php | 21 ++- .../Controller/PageLayoutController.php | 3 +- .../Module/BackendModuleRepository.php | 3 +- .../Container/PaletteAndSingleContainer.php | 3 +- .../Form/FieldWizard/OtherLanguageContent.php | 3 +- .../Classes/Form/FieldWizard/SelectIcons.php | 11 +- .../DatabaseRowDateTimeFields.php | 5 +- .../EvaluateDisplayConditions.php | 3 +- .../TcaColumnsProcessFieldLabels.php | 3 +- .../Classes/Form/InlineStackProcessor.php | 3 +- .../Form/Wizard/ImageManipulationWizard.php | 3 +- .../Classes/RecordList/AbstractRecordList.php | 17 ++- .../Classes/Tree/Pagetree/DataProvider.php | 3 +- .../Classes/Tree/SortedTreeNodeCollection.php | 21 ++- .../Classes/Tree/View/AbstractTreeView.php | 55 ++++--- .../View/ContentLayoutPagePositionMap.php | 3 +- .../View/ElementBrowserFolderTreeView.php | 3 +- .../Tree/View/ElementBrowserPageTreeView.php | 3 +- .../Classes/Tree/View/FolderTreeView.php | 9 +- .../Classes/Utility/BackendUtility.php | 119 ++++++++------- .../Classes/View/BackendLayoutView.php | 3 +- .../backend/Classes/View/PageLayoutView.php | 13 +- .../backend/Classes/View/PageTreeView.php | 3 +- .../ViewHelpers/ErrorIconViewHelper.php | 3 +- .../AbstractUserAuthentication.php | 16 +-- .../BackendUserAuthentication.php | 75 ++++------ .../core/Classes/Cache/Backend/ApcBackend.php | 3 +- .../Classes/Cache/Backend/ApcuBackend.php | 3 +- .../Classes/Cache/Backend/FileBackend.php | 14 +- .../Cache/Backend/MemcachedBackend.php | 6 +- .../Cache/Backend/TransientMemoryBackend.php | 6 +- .../Classes/Cache/Backend/WincacheBackend.php | 3 +- .../Cache/Frontend/VariableFrontend.php | 3 +- .../core/Classes/Charset/CharsetConverter.php | 11 +- .../Configuration/Loader/YamlFileLoader.php | 34 ++--- .../AbstractConditionMatcher.php | 3 +- .../Classes/Controller/FileDumpController.php | 3 +- .../Classes/Core/ClassLoadingInformation.php | 3 +- .../core/Classes/DataHandling/DataHandler.php | 136 +++++++++--------- .../DataHandling/Localization/DataMapItem.php | 10 +- .../Localization/DataMapProcessor.php | 3 +- .../Classes/Database/Query/QueryHelper.php | 6 +- .../core/Classes/Database/ReferenceIndex.php | 35 ++--- .../Database/Schema/ConnectionMigrator.php | 8 +- .../core/Classes/Error/ErrorHandler.php | 76 +++++----- .../Error/ProductionExceptionHandler.php | 6 +- .../core/Classes/ExtDirect/ExtDirectApi.php | 5 +- typo3/sysext/core/Classes/Http/Message.php | 3 +- .../core/Classes/Http/ServerRequest.php | 5 +- .../Classes/Http/ServerRequestFactory.php | 3 +- .../Classes/Imaging/GraphicalFunctions.php | 54 ++++--- .../core/Classes/Imaging/IconRegistry.php | 3 +- .../Imaging/ImageManipulation/Area.php | 3 +- .../CropVariantCollection.php | 6 +- .../Integrity/DatabaseIntegrityCheck.php | 3 +- .../core/Classes/LinkHandling/LinkService.php | 3 +- .../Classes/Localization/LanguageService.php | 5 +- .../Classes/Localization/LanguageStore.php | 6 +- .../Classes/Mail/Rfc822AddressesParser.php | 12 +- .../core/Classes/Migrations/TcaMigration.php | 6 +- .../core/Classes/Package/PackageManager.php | 8 +- .../core/Classes/Resource/AbstractFile.php | 6 +- .../Collection/FileCollectionRegistry.php | 3 +- .../Resource/Driver/DriverRegistry.php | 3 +- .../Classes/Resource/Driver/LocalDriver.php | 12 +- typo3/sysext/core/Classes/Resource/File.php | 8 +- .../Resource/Filter/FileNameFilter.php | 3 +- .../Resource/Index/ExtractorRegistry.php | 6 +- .../core/Classes/Resource/ProcessedFile.php | 12 +- .../Processing/LocalImageProcessor.php | 3 +- .../Resource/Rendering/RendererRegistry.php | 6 +- .../core/Classes/Resource/ResourceFactory.php | 38 ++--- .../core/Classes/Resource/ResourceStorage.php | 27 ++-- .../Service/DependencyOrderingService.php | 11 +- .../TypoScript/ExtendedTemplateService.php | 19 +-- .../TypoScript/Parser/TypoScriptParser.php | 11 +- .../Classes/TypoScript/TemplateService.php | 3 +- .../core/Classes/Utility/GeneralUtility.php | 68 +++++---- .../core/Classes/Utility/MailUtility.php | 9 +- .../core/Classes/Utility/MathUtility.php | 4 +- .../core/Classes/Utility/RootlineUtility.php | 3 +- .../DataHandling/DataHandler/HookTest.php | 3 +- ...ructureParsePreProcessHookReturnString.php | 3 +- .../Fixtures/LocalDriverFilenameFilter.php | 3 +- .../Classes/Service/DocumentationService.php | 16 +-- .../DomainObject/AbstractDomainObject.php | 6 +- .../sysext/extbase/Classes/Error/Message.php | 3 +- .../Classes/Mvc/Controller/Argument.php | 3 +- .../extbase/Classes/Mvc/View/JsonView.php | 65 +++++---- .../extbase/Classes/Mvc/Web/Request.php | 3 +- .../Classes/Mvc/Web/RequestBuilder.php | 6 +- .../Classes/Mvc/Web/Routing/UriBuilder.php | 3 +- .../Classes/Persistence/Generic/Backend.php | 9 +- .../Persistence/Generic/LazyLoadingProxy.php | 3 +- .../Persistence/Generic/Mapper/DataMapper.php | 8 +- .../Generic/PersistenceManager.php | 3 +- .../Classes/Persistence/Generic/Query.php | 6 +- .../Generic/Storage/Typo3DbBackend.php | 3 +- .../Generic/Storage/Typo3DbQueryParser.php | 121 ++++++++-------- .../Classes/Persistence/Repository.php | 6 +- .../Classes/Property/PropertyMapper.php | 18 +-- .../Property/PropertyMappingConfiguration.php | 3 +- .../TypeConverter/DateTimeConverter.php | 3 +- .../TypeConverter/ObjectConverter.php | 18 +-- .../Classes/Reflection/ObjectAccess.php | 15 +- .../Classes/Reflection/ReflectionService.php | 3 +- .../extbase/Classes/Service/ImageService.php | 3 +- .../extbase/Classes/SignalSlot/Dispatcher.php | 6 +- .../Classes/Utility/DebuggerUtility.php | 13 +- .../Classes/Utility/LocalizationUtility.php | 9 +- .../Classes/Utility/TypeHandlingUtility.php | 3 +- .../Validator/CollectionValidator.php | 9 +- .../Validator/GenericObjectValidator.php | 13 +- .../PersistentObjectConverterTest.php | 3 +- .../Classes/Utility/DependencyUtility.php | 16 +-- .../Classes/Utility/InstallUtility.php | 6 +- .../DownloadExtensionViewHelper.php | 6 +- .../InstallationStateCssClassViewHelper.php | 3 +- .../Controller/FrontendLoginController.php | 3 +- typo3/sysext/filelist/Classes/FileList.php | 6 +- .../AbstractConditionViewHelper.php | 3 +- .../Core/ViewHelper/AbstractViewHelper.php | 3 +- .../Be/Security/IfAuthenticatedViewHelper.php | 3 +- .../Be/Security/IfHasRoleViewHelper.php | 3 +- .../ViewHelpers/FlashMessagesViewHelper.php | 9 +- .../Form/Select/OptionViewHelper.php | 3 +- .../ViewHelpers/Form/SelectViewHelper.php | 18 ++- .../Classes/ViewHelpers/FormViewHelper.php | 6 +- .../ViewHelpers/Format/DateViewHelper.php | 3 +- .../Classes/ViewHelpers/MediaViewHelper.php | 5 +- .../Security/IfAuthenticatedViewHelper.php | 3 +- .../Security/IfHasRoleViewHelper.php | 6 +- .../ViewHelpers/Uri/EmailViewHelper.php | 3 +- .../Widget/Controller/PaginateController.php | 11 +- .../ViewHelpers/Widget/UriViewHelper.php | 3 +- .../Classes/Domain/Model/FormDefinition.php | 3 +- .../Model/Renderable/AbstractRenderable.php | 3 +- .../UploadedFileReferenceConverter.php | 3 +- .../RenderAllFormValuesViewHelper.php | 3 +- .../ConditionMatching/ConditionMatcher.php | 5 +- .../ContentObject/ContentObjectRenderer.php | 39 +++-- .../Menu/TextMenuContentObject.php | 3 +- .../TypoScriptFrontendController.php | 22 ++- .../Classes/Page/ExternalPageUrlHandler.php | 3 +- .../frontend/Classes/Page/PageRepository.php | 37 +++-- .../Classes/Plugin/AbstractPlugin.php | 6 +- .../Classes/Resource/FileCollector.php | 3 +- .../Typolink/AbstractTypolinkBuilder.php | 3 +- typo3/sysext/impexp/Classes/Import.php | 26 ++-- typo3/sysext/impexp/Classes/ImportExport.php | 21 ++- .../Repository/IndexSearchRepository.php | 32 ++--- .../sysext/indexed_search/Classes/Indexer.php | 3 +- typo3/sysext/indexed_search/Classes/Lexer.php | 9 +- .../Utility/DoubleMetaPhoneUtility.php | 63 ++++---- .../Ajax/ExtensionCompatibilityTester.php | 3 +- .../Action/Step/EnvironmentAndFolders.php | 3 +- .../Classes/FolderStructure/AbstractNode.php | 6 +- .../Classes/Service/EnableFileService.php | 3 +- .../Classes/Service/SessionService.php | 3 +- .../Classes/SystemEnvironment/Check.php | 3 +- .../Classes/Updates/AbstractUpdate.php | 3 +- .../Updates/DatabaseRowsUpdateWizard.php | 3 +- .../lang/Classes/Service/TerService.php | 39 +++-- .../Classes/Task/ValidatorTask.php | 3 +- .../ValidatorTaskAdditionalFieldProvider.php | 3 +- .../Classes/LinkHandler/FolderLinkHandler.php | 3 +- .../Classes/LinkHandler/PageLinkHandler.php | 3 +- .../Classes/Task/CleanerFieldProvider.php | 3 +- .../Classes/Task/BulkUpdateTask.php | 8 +- .../Utility/SaltedPasswordsUtility.php | 3 +- .../Controller/SchedulerModuleController.php | 3 +- typo3/sysext/scheduler/Classes/Scheduler.php | 27 ++-- ...orageExtractionAdditionalFieldProvider.php | 6 +- ...StorageIndexingAdditionalFieldProvider.php | 3 +- .../sysext/sys_action/Classes/ActionTask.php | 3 +- .../Classes/Dependency/ElementEntity.php | 3 +- .../Controller/ViewModuleController.php | 3 +- .../Controller/Remote/ActionHandler.php | 3 +- .../Classes/Domain/Record/StageRecord.php | 6 +- .../workspaces/Classes/Hook/PreviewHook.php | 18 ++- .../Classes/Service/GridDataService.php | 12 +- .../Classes/Service/IntegrityService.php | 3 +- .../Classes/Service/StagesService.php | 36 +++-- .../Classes/Service/WorkspaceService.php | 6 +- 195 files changed, 1033 insertions(+), 1248 deletions(-) diff --git a/Build/.php_cs b/Build/.php_cs index dc5933d52125..3c75657f91e2 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 264447516076..93bfa6968528 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 5a46e369418a..d196b4d32a16 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 3ffc2e52ddd8..c7f8b60062cf 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 834d2b04d96b..17a3661e2c1c 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 1c5bcf4f9ff4..2c5200d2db7e 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 c977cddee450..a0b1b9cb6975 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 be023af327ae..952a8f5bfab9 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 e61d290a9280..1c862bacf38e 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 ba3b4202f616..e080169dc24b 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 56e70443fada..dd18ae0ca1ae 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 8fcb109f80b4..fc5345a4bb1b 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 4e0599812c3f..fdf5f593be83 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 d89d44488258..776868b4199e 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 3e1e90d551d3..2d05b34f9fe8 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 68a5a7233a3c..ae8c471bad97 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 263c33b40d93..48adc32dc099 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 6645476d47cb..67d3e1b5fe6e 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 ebfc873f2a9b..362791e84867 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 e0a96908f05a..ac4b044ecebb 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 e0e5b0798633..790f93e54882 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 112d956bd0d9..0c0d15096027 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 91a86b9e8ddb..0f6a912f8232 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 21d7185290d6..78aebab371ae 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 8f46e581bd75..83bf446e56b1 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 bb58c70c07fb..2564e31bf185 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 2c0f24674726..95b0ca83bf8a 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 37963cd187fe..15392f634656 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 dc6fe6fb7212..ab6780b1f9c3 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 c8e272f150d9..b0875677ab0a 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 68055be0e429..103a2feb361b 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 4db68489c319..d2e15fc13375 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 e5c72b0e7d2d..3edd00be247b 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 e39ca1b8af95..e68d8874ca3e 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 c75633e6c54c..db58d08407f3 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 0941a85050b2..34b0e3fcd12b 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 f552fb35e401..3fc78ee694e5 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 dc6cfa288753..508873cbc846 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 3e550b13bd4b..b9eb0c055f4d 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 534386c3b368..28172198c6ae 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 7dbd47aa793e..803bc18cfc24 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 6fc76bc39401..46fde70b5959 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 b04eb2d8785b..982d69793248 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 92c8ee76d52f..bcb921d5e20d 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 6f2c6cf9edf4..ff1e60098fed 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 2e79e2472d65..fe6a1c51b335 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 3c5f21480a5b..1c67ec5f90df 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 ab6dc3dcd5ea..e64e42ba9c60 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 49465e484330..b1e97d92937b 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 fb96fd2c6bca..78c7149ea9b8 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 b1fea7377b57..4cf0e7ab838e 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 a44bc2e0b590..4f5daa40f5c1 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 bb18eb4a0b7c..069a5a575556 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 6f115ef4a5c7..39c5a683664f 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 1221e471f3ce..226d81b3feda 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 6cfdcb92290f..bdb94c190ffc 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 023ca889430f..3b3522d6a14e 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 b3babf07e73b..65a155e1f23e 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 1d114b448d39..02bee07b0fc2 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 9036120da6b0..a1dda687b9b4 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 ecef07792c57..7b7e9e64140e 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 bf8cdb9e7be8..253646b99feb 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 5e617688b1b4..d3d4a8abd1dc 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 7b96db8fa97a..df6e16cb9efd 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 949dde54f60f..10a3cf9ee93d 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 890fd7c641a7..d61ceed537b7 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 5a525e0f4d97..4c67cffe6034 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 8865e4049e49..2f28450c88fe 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 728e4f1c6114..f3f0a84d2b48 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 56d77880f37b..ae3d9be1d8bc 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 093819d2deb1..e5def1ff9252 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 7d59e6c3bdd3..b35fd982a243 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 48694b581a47..4145b7548548 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 3b06105d17f1..9dd7a97c79b6 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 2f77ecbce0c7..9fd1da0952b1 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 b4536161bd17..56b0654d8dd0 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 c6339bef79df..3af1e4d81a25 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 ada1f77cd439..54ad8569777a 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 4bff3515d269..41ea48ed3712 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 73d1e8f825bf..b5238fa10d6b 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 2798fb8bde28..465903d0d1e8 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 61865086f2ee..de5f976e7866 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 e4162dbc1f55..8c97941bec8d 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 7aa994541f6a..4107be4b7466 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 df5de9c8ab73..a98f7f2a6c35 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 58d95aa41392..97e1f64b02db 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 a5db2e44ee80..00c32557b50b 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 ac2a98b508a1..f2a7930b0e45 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 b4d262433837..99e41497faa1 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 c564d465593a..5d4752401f3f 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 363587655ad2..51a0b4ae7d1d 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 a182cb506620..5dba704bc54d 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 ee32d0e14641..0e37ddc07190 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 9e3c6b1c322f..d14c00e34f08 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 0feedcf1b64c..57a1cabdac19 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 930ca31c55d5..30c9db4c550c 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 e25cd56fd69b..2ff8abfd1c68 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 419fb4d5855e..9769ad1e566f 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 e2957914e012..e13efb9a3717 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 6659fc4391c9..c132eacb9637 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 4da614e7d538..cc7413721897 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 24bc638bb729..10cd7c863869 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 5177f26aceba..f27a50666ee2 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 c35e12c539c9..c70360260de2 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 f92d070ed944..b4001c1ea1e2 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 fb49f9fc17c0..4adb5bedad8e 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 65d46e36622a..29145b79b8cb 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 c5ff08e0560c..fdf6f1bf66ca 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 9990315bbd22..66003bb3fa73 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 b54916a338e9..84b0bbef436d 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 9932903b1ec7..d3830d4e93cf 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 727cf99d5248..cd98ebe2110e 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 e845ea60e860..3ef22d5a740e 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 e43413ba9eb6..37375ab02e44 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 a87e7ab0c9e3..badf8bcaff95 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 7ea8070c6e55..3152ff5c4b57 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 e775cbc64ab9..06a284282f04 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 7d71827c225a..51f05dcbc845 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 e6dc178feee9..bfe3d9bf184f 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 5711fb2ec88f..c524e71928cc 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 256d0759abf5..1dd951a214cd 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 da0b32daff79..a363b856ac46 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 9c0d47bddfc4..45705b95a52f 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 97ccecccb27b..a45aaf95943a 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 899bfef624f1..689f4417eded 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 0045d3195fc1..d8490f6edb9e 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 65b16b62f558..091c8c7047e0 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 1bc68c6276cd..fa9c6baeae17 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 ee71dee40022..1ab37424dc62 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 27476bf79429..6792f1166ee3 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 bce7459fb93c..98d0ca5bf15b 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 07c243e1f70f..353e8e639c47 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 5bffd1063771..3dba9f82634f 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 199fdd6ec4dd..768412b9c8d2 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 580a4468264e..cf3305a64a6b 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 874e0061229b..20eb6fd97eeb 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 8884f46dabb1..981fd325c504 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 b7c3bc42812f..574c1ab198ff 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 05de4f7bc3d1..10d7b46c9b87 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 f1d1f5ae1cd0..50d0d1874382 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 81a1b27dec09..c979e5bbe54a 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 d1f5564784fb..4340be5fbad8 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 5ebebebd0878..1de981024e78 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 42ae3f985625..ea882502f0a4 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 c34cbce426f4..878a60e742c7 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 b1d4a310cf08..0573edced32e 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 2bee2f5a1d2c..7eb612264c0d 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 f1b1298249af..ce6ae11de7c2 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 0a257e99a57e..153395745f4c 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 a302e04a4069..29725a81c6d7 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 e161508021c5..1f597c3c14ab 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 20afcff95318..d1256cfae21c 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 5af87d622f54..d53907230d20 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 1bc53348d98f..64ec04c636ad 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 1448930f8c24..7aeea85464e0 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 4385ba325fb4..b23ccb851d13 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 6cdbaa2c68bc..38ccc8c044da 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 b2fe32fe12a7..5876b25fdee5 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 48ec05cbbc54..2158ce6b899d 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 231ae1dfc7e0..b1e2a474b69f 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 95f584aae389..8232b0a0ddfd 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 d011ffe79355..87fa243f2d09 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 daeab9ac9d64..8c2882ebf4ae 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 6bb8328b55c5..a926ab5c0fa7 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 be03aee6a889..0c665f287a38 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 81f6da8a2df6..ef517421794e 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 46df25c9a123..d8f5bbde8e79 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 99a6314a88ab..6686236e7a65 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 f529da593572..9e3bf9780371 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 470a5259947e..de387b2df64c 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 596a8f3a8b06..2f2d1edc56e8 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 a2eae36fefff..1cac4c4e5b97 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 8ad2ca9d0ac2..aab808e47746 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 c206abb01802..2ac9757c499d 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 e4f7b5d4c7aa..b3c0cc0e6a71 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 d87bb0e0657e..929bf62c03ef 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 d2fd06ef0357..07e7962d4fb2 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 3bf396c8cf6f..2999fdde5103 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 a7af82faf874..fdb2f78c7b77 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 0cc87c193580..5c22fbdaa93e 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 d24eab8874f5..b5f2e983e5bc 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 fa073b124412..c55ca00b302d 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 f59d8c127f6b..b0684a38e958 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 0c573ec0da4c..4475581218ff 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 3f870fbe2e1d..8a33bd91f788 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 c55f7bb08138..f771a0048a00 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 a2bb594068ab..f6a4811c828a 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 83af9e6ab687..8c2725e1bc6a 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 e2e17c2070d4..08a36ed830c4 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 f156edc089c8..f9dbea743af1 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 a4c5e96fb009..6fe3718c8ea1 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 a80240ec02ac..09068a01a05e 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 1c833bbffd7f..fbb89e8f10e7 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 c4270b4cc76a..4d41cf87c8d1 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 9515e01c2b43..f03a1c48d539 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; } /** -- GitLab