Commit 3b451421 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Andreas Fernandez
Browse files

[TASK] Include all classes via use statements in ext:backend

This patch has been created with rector and php-cs-fixer

    bin/rector process --set=php53 typo3/sysext/backend/Classes
    bin/rector process --set=php53 typo3/sysext/backend/Tests

Releases: master
Resolves: #91064
Change-Id: I9e91882ab233b0e34bc991fd348fceba197a91ea
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64187

Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 19889aa8
......@@ -23,6 +23,9 @@ use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Resource\AbstractFile;
use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
......@@ -384,11 +387,11 @@ class Clipboard
$fileObject = GeneralUtility::makeInstance(ResourceFactory::class)->retrieveFileOrFolderObject($v);
if ($fileObject) {
$thumb = [];
$folder = $fileObject instanceof \TYPO3\CMS\Core\Resource\Folder;
$folder = $fileObject instanceof Folder;
$size = $folder ? '' : '(' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes)';
if (!$folder && $fileObject->isImage()) {
$thumb = [
'image' => $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, [])->getPublicUrl(true),
'image' => $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, [])->getPublicUrl(true),
'title' => htmlspecialchars($fileObject->getName())
];
}
......@@ -834,7 +837,7 @@ class Clipboard
} else {
try {
GeneralUtility::makeInstance(ResourceFactory::class)->retrieveFileOrFolderObject($v);
} catch (\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException $e) {
} catch (ResourceDoesNotExistException $e) {
// The file has been deleted in the meantime, so just remove it silently
unset($this->clipData[$this->current]['el'][$k]);
}
......
......@@ -15,7 +15,9 @@
namespace TYPO3\CMS\Backend\Configuration;
use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -23,7 +25,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*
* @deprecated Should not be used anymore. See the PageTsConfigParser class, which has a more straightforward API. This class will be removed in TYPO3 v11.0.
*/
class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
class TsConfigParser extends TypoScriptParser
{
/**
* @var array
......@@ -119,7 +121,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
protected function parseWithConditions($TSconfig)
{
/** @var \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher $matchObj */
$matchObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::class);
$matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
$matchObj->setRootline($this->rootLine);
$matchObj->setPageId($this->id);
$this->parse($TSconfig, $matchObj);
......@@ -140,7 +142,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
{
if (is_array($cc['sections'])) {
/** @var \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher $matchObj */
$matchObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::class);
$matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
$matchObj->setRootline($this->rootLine);
$matchObj->setPageId($this->id);
foreach ($cc['sections'] as $key => $pre) {
......
......@@ -17,6 +17,8 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\ContextMenu;
use TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider;
use TYPO3\CMS\Backend\ContextMenu\ItemProviders\RecordProvider;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -31,8 +33,8 @@ class ContextMenu
* @var array
*/
protected $itemProviders = [
ItemProviders\PageProvider::class,
ItemProviders\RecordProvider::class
PageProvider::class,
RecordProvider::class
];
/**
......
......@@ -23,6 +23,7 @@ use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Tree\View\ContentMovingPagePositionMap;
use TYPO3\CMS\Backend\Tree\View\PageMovingPagePositionMap;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendLayoutView;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -201,7 +202,7 @@ class MoveElementController
$assigns['ttContent']['pageInfo'] = $pageInfo;
$assigns['ttContent']['recordTooltip'] = BackendUtility::getRecordToolTip($pageInfo, 'pages');
$assigns['ttContent']['recordTitle'] = BackendUtility::getRecordTitle('pages', $pageInfo, true);
$colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this);
$colPosArray = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this);
$colPosIds = [];
foreach ($colPosArray as $colPos) {
$colPosIds[] = $colPos[1];
......
......@@ -734,9 +734,11 @@ class EditDocumentController
}
// If a preview is requested
if (isset($parsedBody['_savedokview'])) {
$array_keys = array_keys($this->data);
// Get the first table and id of the data array from DataHandler
$table = reset(array_keys($this->data));
$id = reset(array_keys($this->data[$table]));
$table = reset($array_keys);
$array_keys = array_keys($this->data[$table]);
$id = reset($array_keys);
if (!MathUtility::canBeInterpretedAsInteger($id)) {
$id = $tce->substNEWwithIDs[$id];
}
......
......@@ -21,6 +21,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Resource\Exception;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\ArrayUtility;
......@@ -52,7 +53,7 @@ class ThumbnailController
$parameters['fileId'] ?? null,
$parameters['configuration'] ?? []
);
} catch (\TYPO3\CMS\Core\Resource\Exception $exception) {
} catch (Exception $exception) {
// catch and handle only resource related exceptions
$response = $this->generateNotFoundResponse();
}
......
......@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Http\HtmlResponse;
......@@ -118,7 +119,7 @@ class EditController extends AbstractWizardController
}
}
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$urlParameters = [
'returnUrl' => (string)$uriBuilder->buildUriFromRoute('wizard_edit', ['doClose' => 1])
];
......
......@@ -17,18 +17,20 @@ namespace TYPO3\CMS\Backend\Domain\Repository\Module;
use TYPO3\CMS\Backend\Domain\Model\Module\BackendModule;
use TYPO3\CMS\Backend\Module\ModuleLoader;
use TYPO3\CMS\Backend\Module\ModuleStorage;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Repository for backend module menu
* compiles all data from $GLOBALS[TBE_MODULES]
*/
class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
class BackendModuleRepository implements SingletonInterface
{
/**
* @var \TYPO3\CMS\Backend\Module\ModuleStorage
......@@ -40,7 +42,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
*/
public function __construct()
{
$this->moduleStorage = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleStorage::class);
$this->moduleStorage = GeneralUtility::makeInstance(ModuleStorage::class);
$rawData = $this->getRawModuleMenuData();
......@@ -152,7 +154,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
protected function createEntryFromRawData(array $module)
{
/** @var \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule $entry */
$entry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Domain\Model\Module\BackendModule::class);
$entry = GeneralUtility::makeInstance(BackendModule::class);
if (!empty($module['name']) && is_string($module['name'])) {
$entry->setName($module['name']);
}
......
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Backend\Form\Element\InlineElementHookInterface;
use TYPO3\CMS\Backend\Form\Exception\AccessDeniedContentEditException;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\ConnectionPool;
......@@ -540,7 +541,7 @@ class InlineRecordContainer extends AbstractContainer
->execute()
->fetch();
if (!empty($recordInDatabase)) {
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', [
'edit[sys_file_metadata][' . (int)$recordInDatabase['uid'] . ']' => 'edit',
'returnUrl' => $this->data['returnUrl']
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Form\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -102,7 +103,7 @@ class AddRecord extends AbstractNode
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return [
'iconIdentifier' => 'actions-add',
'title' => $title,
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Form\FieldControl;
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;
......@@ -80,7 +81,7 @@ class EditPopup extends AbstractNode
'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc'])),
],
];
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('wizard_edit', $urlParameters);
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Form\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -66,7 +67,7 @@ class LinkPopup extends AbstractNode
],
];
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('wizard_link', $urlParameters);
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Form\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -88,7 +89,7 @@ class ListModule extends AbstractNode
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return [
'iconIdentifier' => 'actions-system-list-open',
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Form\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
......@@ -72,7 +73,7 @@ class TableWizard extends AbstractNode
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return [
'iconIdentifier' => 'content-table',
'title' => $title,
......
......@@ -33,6 +33,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\ArrayUtility;
......@@ -731,7 +732,7 @@ abstract class AbstractItemProvider
}
$allowedStorageIds = array_map(
function (\TYPO3\CMS\Core\Resource\ResourceStorage $storage) {
function (ResourceStorage $storage) {
return $storage->getUid();
},
$this->getBackendUser()->getFileStorages()
......@@ -1329,7 +1330,7 @@ abstract class AbstractItemProvider
}
$value = strlen((string)$item[1]) > 0 ? $item[1] : '';
$icon = !empty($item[2]) ? $item[2] : null;
$groupId = isset($item[3]) ? $item[3] : null;
$groupId = $item[3] ?? null;
$helpText = null;
if (!empty($item[4])) {
if (\is_string($item[4])) {
......
......@@ -15,6 +15,7 @@
namespace TYPO3\CMS\Backend\Form;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\ArrayUtility;
......@@ -182,7 +183,7 @@ class FormResultCompiler
{
$pageRenderer = $this->getPageRenderer();
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
// @todo: this is messy here - "additional hidden fields" should be handled elsewhere
$html = implode(LF, $this->hiddenFieldAccum);
......
......@@ -91,7 +91,6 @@ class FrontendBackendUserAuthentication extends BackendUserAuthentication
/**
* Edit Access
*/
/**
* Checks whether the user has access to edit the language for the
* requested record.
......
......@@ -15,6 +15,7 @@
namespace TYPO3\CMS\Backend\Module;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -156,7 +157,7 @@ class ModuleLoader
// Language processing. This will add module labels and image reference to the internal ->moduleLabels array of the LANG object.
$this->addLabelsForModule($name, $finalModuleConfiguration['labels'] ?? $setupInformation['labels']);
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
if (isset($setupInformation['configuration']['routeTarget'])) {
$finalModuleConfiguration['script'] = (string)$uriBuilder->buildUriFromRoute($name);
} else {
......
......@@ -16,11 +16,12 @@
namespace TYPO3\CMS\Backend\Module;
use TYPO3\CMS\Backend\Domain\Model\Module\BackendModule;
use TYPO3\CMS\Core\SingletonInterface;
/**
* Model for the module storage
*/
class ModuleStorage implements \TYPO3\CMS\Core\SingletonInterface
class ModuleStorage implements SingletonInterface
{
/**
* @var \SplObjectStorage
......
......@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout;
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection;
use TYPO3\CMS\Backend\View\BackendLayout\DataProviderContext;
use TYPO3\CMS\Backend\View\BackendLayout\DataProviderInterface;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -177,7 +178,7 @@ class PageTsBackendLayoutDataProvider implements DataProviderInterface
$backendLayout['title'] = $data['title'] ?: $backendLayout['uid'];
$backendLayout['icon'] = $data['icon'] ?: '';
// Convert PHP array back to plain TypoScript so it can be processed
$config = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($data['config.']);
$config = ArrayUtility::flatten($data['config.']);
$backendLayout['config'] = '';
foreach ($config as $row => $value) {
$backendLayout['config'] .= $row . ' = ' . $value . "\r\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment