From ceb903264c3f34852b87c6e61c47a90e86106600 Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Mon, 19 Oct 2020 23:49:16 +0200 Subject: [PATCH] [TASK] Drop a series of unused code occurences A couple of not needed assignments throughout the core and a 'too many arguments' fix. Resolves: #92605 Releases: master Change-Id: I883dc2fcc12c72c525bc7a44236cac8311d96f11 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66182 Tested-by: TYPO3com Tested-by: Oliver Bartsch Tested-by: Daniel Goerz Reviewed-by: Oliver Bartsch Reviewed-by: Daniel Goerz --- .../Classes/Controller/EditDocumentController.php | 2 +- .../Classes/Form/Element/SelectSingleElement.php | 1 - .../backend/Classes/Form/FieldControl/EditPopup.php | 12 ------------ .../Classes/Tree/View/ElementBrowserPageTreeView.php | 3 +-- .../Authentication/AbstractUserAuthentication.php | 1 - .../Classes/Authentication/AuthenticationService.php | 3 +-- .../Classes/DependencyInjection/ContainerBuilder.php | 2 -- .../Classes/Domain/Repository/PageRepository.php | 1 - .../sysext/core/Classes/Resource/ResourceStorage.php | 3 --- .../core/Classes/Resource/StorageRepository.php | 1 - .../Generic/Storage/Typo3DbQueryParser.php | 2 +- typo3/sysext/filelist/Classes/FileList.php | 2 +- .../Classes/Controller/FormManagerController.php | 1 - .../ViewHelpers/RenderFormValueViewHelper.php | 2 -- .../Classes/ContentObject/ContentObjectRenderer.php | 5 +---- .../frontend/Classes/Middleware/PreviewSimulator.php | 1 - typo3/sysext/impexp/Classes/Import.php | 2 +- ...ptTemplateInformationModuleFunctionController.php | 1 - 18 files changed, 7 insertions(+), 38 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index f8a1c98f31cf..d77cf1bc8c09 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -1197,7 +1197,7 @@ protected function makeEditForm(): string $this->errorC++; // Try to fetch error message from "recordInternals" be user object // @todo: This construct should be logged and localized and de-uglified - $message = (!empty($beUser->errorMsg)) ? $beUser->errorMsg : $message = $e->getMessage() . ' ' . $e->getCode(); + $message = (!empty($beUser->errorMsg)) ? $beUser->errorMsg : $e->getMessage() . ' ' . $e->getCode(); $title = $this->getLanguageService() ->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noEditPermission'); $editForm .= $this->getInfobox($message, $title); diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php index 1e6d447c05f8..13c9fe5c8564 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php @@ -76,7 +76,6 @@ public function render() $table = $this->data['tableName']; $field = $this->data['fieldName']; - $row = $this->data['databaseRow']; $parameterArray = $this->data['parameterArray']; $config = $parameterArray['fieldConf']['config']; diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php b/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php index 849b47b4d3d8..c0224871c51c 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php @@ -19,7 +19,6 @@ use TYPO3\CMS\Backend\Form\AbstractNode; use TYPO3\CMS\Backend\Routing\UriBuilder; -use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\StringUtility; @@ -36,7 +35,6 @@ class EditPopup extends AbstractNode */ public function render() { - $languageService = $this->getLanguageService(); $options = $this->data['renderData']['fieldControlOptions']; $title = $options['title'] ?? 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit'; @@ -100,14 +98,4 @@ public function render() ], ]; } - - /** - * Returns an instance of LanguageService - * - * @return LanguageService - */ - protected function getLanguageService() - { - return $GLOBALS['LANG']; - } } diff --git a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php index 5e4a533ce118..d2d611b0cfc2 100644 --- a/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php @@ -167,13 +167,12 @@ public function ext_isLinkable($doktype, $uid) * * @param string $icon HTML string to wrap, probably an image tag. * @param string $cmd Command for 'PM' get var - * @param string $bMark If set, the link will have an anchor point (=$bMark) and a name attribute (=$bMark) + * @param string $bMark If set, the link will have a name attribute (=$bMark) * @param bool $isOpen * @return string Link-wrapped input string */ public function PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false) { - $anchor = $bMark ? '#' . $bMark : ''; $name = $bMark ? ' name=' . $bMark : ''; $urlParameters = $this->linkParameterProvider->getUrlParameters([]); $urlParameters['PM'] = $cmd; diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 57e096800c9f..d9c44116412c 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -428,7 +428,6 @@ protected function setSessionCookie() $isSetSessionCookie = $this->isSetSessionCookie(); $isRefreshTimeBasedCookie = $this->isRefreshTimeBasedCookie(); if ($isSetSessionCookie || $isRefreshTimeBasedCookie) { - $settings = $GLOBALS['TYPO3_CONF_VARS']['SYS']; // Get the domain to be used for the cookie (if any): $cookieDomain = $this->getCookieDomain(); // If no cookie domain is set, use the base path: diff --git a/typo3/sysext/core/Classes/Authentication/AuthenticationService.php b/typo3/sysext/core/Classes/Authentication/AuthenticationService.php index 5d5e0175477d..ddbf9b0aa9fc 100644 --- a/typo3/sysext/core/Classes/Authentication/AuthenticationService.php +++ b/typo3/sysext/core/Classes/Authentication/AuthenticationService.php @@ -118,10 +118,9 @@ public function authUser(array $user): int $saltFactory = GeneralUtility::makeInstance(PasswordHashFactory::class); // Get a hashed password instance for the hash stored in db of this user - $invalidPasswordHashException = null; try { $hashInstance = $saltFactory->get($passwordHashInDatabase, $this->pObj->loginType); - } catch (InvalidPasswordHashException $invalidPasswordHashException) { + } catch (InvalidPasswordHashException $exception) { // Could not find a responsible hash algorithm for given password. This is unusual since other // authentication services would usually be called before this one with higher priority. We thus log // the failed login but still return '100' to proceed with other services that may follow. diff --git a/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php b/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php index 7e465b977f9b..8df0e0ae494d 100644 --- a/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php +++ b/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php @@ -74,8 +74,6 @@ public function createDependencyInjectionContainer(PackageManager $packageManage return new FailsafeContainer($serviceProviderRegistry, $this->defaultServices); } - $container = null; - $cacheIdentifier = $this->getCacheIdentifier($packageManager); $containerClassName = $cacheIdentifier; diff --git a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php index 7b6919e03cb7..20b3b714118a 100644 --- a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php +++ b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php @@ -1487,7 +1487,6 @@ public function fixVersioningPid($table, &$rr) return; } $uid = (int)$rr['uid']; - $oid = 0; $workspaceId = 0; $versionState = null; // Check values for t3ver_state and t3ver_wsid diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorage.php b/typo3/sysext/core/Classes/Resource/ResourceStorage.php index 02c6d9f08308..f4a7c1130238 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceStorage.php +++ b/typo3/sysext/core/Classes/Resource/ResourceStorage.php @@ -2188,10 +2188,8 @@ protected function getAllFileObjectsInFolder(Folder $folder) public function moveFolder(Folder $folderToMove, Folder $targetParentFolder, $newFolderName = null, $conflictMode = DuplicationBehavior::RENAME) { // @todo add tests - $originalFolder = $folderToMove->getParentFolder(); $this->assureFolderMovePermissions($folderToMove, $targetParentFolder); $sourceStorage = $folderToMove->getStorage(); - $returnObject = null; $sanitizedNewFolderName = $this->driver->sanitizeFileName($newFolderName ?: $folderToMove->getName()); // @todo check if folder already exists in $targetParentFolder, handle this conflict then $this->eventDispatcher->dispatch( @@ -2321,7 +2319,6 @@ public function renameFolder($folderObject, $newName) } $sanitizedNewName = $this->driver->sanitizeFileName($newName); - $returnObject = null; if ($this->driver->folderExistsInFolder($sanitizedNewName, $folderObject->getIdentifier())) { throw new \InvalidArgumentException('The folder ' . $sanitizedNewName . ' already exists in folder ' . $folderObject->getIdentifier(), 1325418870); } diff --git a/typo3/sysext/core/Classes/Resource/StorageRepository.php b/typo3/sysext/core/Classes/Resource/StorageRepository.php index c1b45f81e781..47c86e8a0927 100644 --- a/typo3/sysext/core/Classes/Resource/StorageRepository.php +++ b/typo3/sysext/core/Classes/Resource/StorageRepository.php @@ -337,7 +337,6 @@ public function getStorageObject($uid, array $recordData = [], &$fileIdentifier } if (empty($this->storageInstances[$uid])) { $storageConfiguration = null; - $storageObject = null; /** @var BeforeResourceStorageInitializationEvent $event */ $event = $this->eventDispatcher->dispatch(new BeforeResourceStorageInitializationEvent($uid, $recordData, $fileIdentifier)); $recordData = $event->getRecord(); diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php index c419427ab1db..4edcc5172e02 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php @@ -769,7 +769,7 @@ protected function getFrontendConstraintStatement($tableName, $ignoreEnableField if ($ignoreEnableFields && !$includeDeleted) { if (!empty($enableFieldsToBeIgnored)) { // array_combine() is necessary because of the way \TYPO3\CMS\Core\Domain\Repository\PageRepository::enableFields() is implemented - $statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored), true); + $statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored)); } elseif (!empty($GLOBALS['TCA'][$tableName]['ctrl']['delete'])) { $statement .= ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['delete'] . '=0'; } diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php index bba7522617d4..296912226d3d 100644 --- a/typo3/sysext/filelist/Classes/FileList.php +++ b/typo3/sysext/filelist/Classes/FileList.php @@ -1040,7 +1040,7 @@ public function makeEdit($fileOrFolderObject) // replace file if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('replace')) { $attributes = [ - 'href' => $url = (string)$this->uriBuilder->buildUriFromRoute('file_replace', ['target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid(), 'returnUrl' => $this->listURL()]), + 'href' => (string)$this->uriBuilder->buildUriFromRoute('file_replace', ['target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid(), 'returnUrl' => $this->listURL()]), 'title' => $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.replace'), ]; $cells['replace'] = '' . $this->iconFactory->getIcon('actions-edit-replace', Icon::SIZE_SMALL)->render() . ''; diff --git a/typo3/sysext/form/Classes/Controller/FormManagerController.php b/typo3/sysext/form/Classes/Controller/FormManagerController.php index e20ccacedcba..b1ca58e03e20 100644 --- a/typo3/sysext/form/Classes/Controller/FormManagerController.php +++ b/typo3/sysext/form/Classes/Controller/FormManagerController.php @@ -460,7 +460,6 @@ protected function registerDocheaderButtons() $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar(); $currentRequest = $this->request; $moduleName = $currentRequest->getPluginName(); - $getVars = $this->request->getArguments(); // Create new $addFormButton = $buttonBar->makeLinkButton() diff --git a/typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php b/typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php index 52325e17d838..84527e294871 100644 --- a/typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php +++ b/typo3/sysext/form/Classes/ViewHelpers/RenderFormValueViewHelper.php @@ -177,8 +177,6 @@ public static function mapValueToOption($value, array $options) */ public static function processObject(FormElementInterface $element, $object): string { - $properties = $element->getProperties(); - if ($element instanceof StringableFormElementInterface) { return $element->valueToString($object); } diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 1a75b3f4b540..96ab80d71e68 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -4547,8 +4547,6 @@ public function getKey($key, $arr) */ protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$configuration = []) { - $linkParameter = null; - // Link parameter value = first part $linkParameterParts = GeneralUtility::makeInstance(TypoLinkCodecService::class)->decode($mixedLinkParameter); @@ -4560,7 +4558,6 @@ protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$c // Disallow insecure scheme's like javascript: or data: return $linkText; } - $linkParameter = $linkParameterParts['url']; // additional parameters that need to be set if ($linkParameterParts['additionalParams'] !== '') { @@ -4570,7 +4567,7 @@ protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$c } return [ - 'href' => $linkParameter, + 'href' => $linkParameterParts['url'], 'target' => $linkParameterParts['target'], 'class' => $linkParameterParts['class'], 'title' => $linkParameterParts['title'] diff --git a/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php b/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php index a7481eddda91..bf8a0d63231a 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php +++ b/typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php @@ -80,7 +80,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface */ protected function simulateDate(ServerRequestInterface $request): bool { - $simulatedDate = null; $queryTime = $request->getQueryParams()['ADMCMD_simTime'] ?? false; if (!$queryTime) { return false; diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php index 1f1d470a54b2..ae2d26ac33cc 100644 --- a/typo3/sysext/impexp/Classes/Import.php +++ b/typo3/sysext/impexp/Classes/Import.php @@ -1414,7 +1414,7 @@ public function processSoftReferences_substTokens($tokenizedContent, $softRefCfg */ public function processSoftReferences_saveFile($relFileName, $cfg, $table, $uid) { - if ($fileHeaderInfo = $this->dat['header']['files'][$cfg['file_ID']]) { + if ($this->dat['header']['files'][$cfg['file_ID']]) { // Initialize; Get directory prefix for file and find possible RTE filename $dirPrefix = PathUtility::dirname($relFileName) . '/'; if (GeneralUtility::isFirstPartOfStr($dirPrefix, $this->fileadminFolderName . '/')) { diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php index 9cd62f98af87..86f078121c30 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php @@ -157,7 +157,6 @@ public function main() $url = (string)$uriBuilder->buildUriFromRoute('web_ts', $urlParameters); HttpUtility::redirect($url); } - $tce = null; if ($existTemplate) { $lang = $this->getLanguageService(); $lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_info.xlf');