[TASK] Cleanup code imports for all workspaces classes 06/56006/2
authorBenni Mack <benni@typo3.org>
Mon, 5 Mar 2018 06:42:35 +0000 (07:42 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 5 Mar 2018 08:34:47 +0000 (09:34 +0100)
The system extension workspaces was never touched in terms of
checking if actually methods are needed, and a lot of code still uses
FQDN instead of the "use" keyword for a PHP class.

Some unused dependencies (e.g. to Extbase's objectmanager) are
removed as well.

Resolves: #84136
Releases: master
Change-Id: Ifa71ce9dddb6d0e68e09ee969d217d1514105a1a
Reviewed-on: https://review.typo3.org/56006
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
29 files changed:
typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php
typo3/sysext/workspaces/Classes/Controller/AjaxController.php
typo3/sysext/workspaces/Classes/Controller/AjaxDispatcher.php
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Controller/Remote/AbstractHandler.php
typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php
typo3/sysext/workspaces/Classes/Controller/Remote/MassActionHandler.php
typo3/sysext/workspaces/Classes/Controller/Remote/RemoteServer.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Classes/DataHandler/CommandMap.php
typo3/sysext/workspaces/Classes/Dependency/DependencyEntityFactory.php
typo3/sysext/workspaces/Classes/Dependency/DependencyResolver.php
typo3/sysext/workspaces/Classes/Dependency/ElementEntity.php
typo3/sysext/workspaces/Classes/Dependency/ElementEntityProcessor.php
typo3/sysext/workspaces/Classes/Dependency/ReferenceEntity.php
typo3/sysext/workspaces/Classes/Domain/Model/CombinedRecord.php
typo3/sysext/workspaces/Classes/Domain/Model/DatabaseRecord.php
typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php
typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php
typo3/sysext/workspaces/Classes/Service/AdditionalColumnService.php
typo3/sysext/workspaces/Classes/Service/AdditionalResourceService.php
typo3/sysext/workspaces/Classes/Service/AutoPublishService.php
typo3/sysext/workspaces/Classes/Service/Dependency/CollectionService.php
typo3/sysext/workspaces/Classes/Service/GridDataService.php
typo3/sysext/workspaces/Classes/Service/HistoryService.php
typo3/sysext/workspaces/Classes/Service/IntegrityService.php
typo3/sysext/workspaces/Classes/Service/RecordService.php
typo3/sysext/workspaces/Classes/Service/StagesService.php
typo3/sysext/workspaces/Classes/Service/WorkspaceService.php

index a688f45..96df683 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Workspaces\Backend\ToolbarItems;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -78,8 +79,7 @@ class WorkspaceSelectorToolbarItem implements ToolbarItemInterface
         $backendUser = $this->getBackendUser();
         $view = $this->getFluidTemplateObject('DropDown.html');
         $activeWorkspace = (int)$backendUser->workspace;
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         foreach ($this->availableWorkspaces as $workspaceId => $label) {
             $workspaceId = (int)$workspaceId;
             $item = [
index 0eafc7e..fbb7f67 100644 (file)
@@ -17,8 +17,10 @@ namespace TYPO3\CMS\Workspaces\Controller;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Http\JsonResponse;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 
 /**
  * Implements the AJAX functionality for the various asynchronous calls
@@ -65,7 +67,7 @@ class AjaxController
         }
 
         $ajaxResponse = [
-            'title'       => \TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($workspaceId),
+            'title'       => WorkspaceService::getWorkspaceTitle($workspaceId),
             'workspaceId' => $workspaceId,
             'pageId'      => ($finalPageUid && $originalPageId == $finalPageUid) ? null : $finalPageUid
         ];
@@ -73,7 +75,7 @@ class AjaxController
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+     * @return BackendUserAuthentication
      */
     protected function getBackendUser()
     {
index c07e875..53697fa 100644 (file)
@@ -42,7 +42,7 @@ class AjaxDispatcher
      */
     public function dispatch(ServerRequestInterface $request): ResponseInterface
     {
-        $callStack = \GuzzleHttp\json_decode($request->getBody()->getContents());
+        $callStack = json_decode($request->getBody()->getContents());
         if (!is_array($callStack)) {
             $callStack = [$callStack];
         }
index b7ee0c8..f9ecd49 100644 (file)
@@ -26,6 +26,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Workspaces\Service\StagesService;
 use TYPO3\CMS\Workspaces\Service\WorkspaceService;
+use TYPO3Fluid\Fluid\View\ViewInterface;
 
 /**
  * Implements the preview controller of the workspace module.
@@ -55,7 +56,7 @@ class PreviewController
     protected $moduleTemplate;
 
     /**
-     * @var \TYPO3Fluid\Fluid\View\ViewInterface
+     * @var ViewInterface
      */
     protected $view;
 
index 4887fa6..0284c29 100644 (file)
@@ -14,6 +14,12 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
+use TYPO3\CMS\Workspaces\Service\IntegrityService;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
+
 /**
  * Class AbstractHandler
  */
@@ -53,11 +59,11 @@ abstract class AbstractHandler
     /**
      * Gets an instance of the workspaces service.
      *
-     * @return \TYPO3\CMS\Workspaces\Service\WorkspaceService
+     * @return WorkspaceService
      */
     protected function getWorkspaceService()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
+        return GeneralUtility::makeInstance(WorkspaceService::class);
     }
 
     /**
@@ -70,7 +76,7 @@ abstract class AbstractHandler
     protected function validateLanguageParameter(\stdClass $parameters)
     {
         $language = null;
-        if (isset($parameters->language) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($parameters->language)) {
+        if (isset($parameters->language) && MathUtility::canBeInterpretedAsInteger($parameters->language)) {
             $language = $parameters->language;
         }
         return $language;
@@ -90,13 +96,13 @@ abstract class AbstractHandler
         $affectedElements = [];
         if ($parameters->type === 'selection') {
             foreach ((array)$parameters->selection as $element) {
-                $affectedElements[] = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($element->table, $element->liveId, $element->versionId);
+                $affectedElements[] = CombinedRecord::create($element->table, $element->liveId, $element->versionId);
             }
         } elseif ($parameters->type === 'all') {
             $versions = $this->getWorkspaceService()->selectVersionsInWorkspace($this->getCurrentWorkspace(), 0, -99, -1, 0, 'tables_select', $this->validateLanguageParameter($parameters));
             foreach ($versions as $table => $tableElements) {
                 foreach ($tableElements as $element) {
-                    $affectedElement = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::create($table, $element['t3ver_oid'], $element['uid']);
+                    $affectedElement = CombinedRecord::create($table, $element['t3ver_oid'], $element['uid']);
                     $affectedElement->getVersionRecord()->setRow($element);
                     $affectedElements[] = $affectedElement;
                 }
@@ -109,14 +115,13 @@ abstract class AbstractHandler
      * Creates a new instance of the integrity service for the
      * given set of affected elements.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord[] $affectedElements
-     * @return \TYPO3\CMS\Workspaces\Service\IntegrityService
+     * @param CombinedRecord[] $affectedElements
+     * @return IntegrityService
      * @see getAffectedElements
      */
     protected function createIntegrityService(array $affectedElements)
     {
-        /** @var $integrityService \TYPO3\CMS\Workspaces\Service\IntegrityService */
-        $integrityService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\IntegrityService::class);
+        $integrityService = GeneralUtility::makeInstance(IntegrityService::class);
         $integrityService->setAffectedElements($affectedElements);
         return $integrityService;
     }
index 23ea6b7..cec3676 100644 (file)
@@ -15,8 +15,12 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Core\Exception;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Workspaces\Domain\Record\StageRecord;
 use TYPO3\CMS\Workspaces\Domain\Record\WorkspaceRecord;
@@ -216,7 +220,7 @@ class ActionHandler extends AbstractHandler
      */
     public function saveLanguageSelection($language)
     {
-        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($language) === false && $language !== 'all') {
+        if (MathUtility::canBeInterpretedAsInteger($language) === false && $language !== 'all') {
             $language = 'all';
         }
         $GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['language'] = $language;
@@ -362,7 +366,7 @@ class ActionHandler extends AbstractHandler
         }
 
         if ($stageRecord->hasPreselection() && !$stageRecord->isPreselectionChangeable()) {
-            $preselectedBackendUsers = $this->getStageService()->getBackendUsers(
+            $preselectedBackendUsers = $this->stageService->getBackendUsers(
                 implode(',', $this->stageService->getPreselectedRecipients($stageRecord))
             );
 
@@ -411,12 +415,9 @@ class ActionHandler extends AbstractHandler
     public function discardStagesFromPage($pageId)
     {
         $cmdMapArray = [];
-        /** @var $workspaceService WorkspaceService */
         $workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
-        /** @var $stageService StagesService */
-        $stageService = GeneralUtility::makeInstance(StagesService::class);
         $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
-            $stageService->getWorkspaceId(),
+            $this->stageService->getWorkspaceId(),
             $filter = 1,
             $stage = -99,
             $pageId,
@@ -453,7 +454,7 @@ class ActionHandler extends AbstractHandler
         $cmdMapArray = [];
         $comment = $parameters->comments;
         $stageId = $parameters->stageId;
-        if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($stageId) === false) {
+        if (MathUtility::canBeInterpretedAsInteger($stageId) === false) {
             throw new \InvalidArgumentException('Missing "stageId" in $parameters array.', 1319488194);
         }
         if (!is_object($parameters->affects) || empty($parameters->affects)) {
@@ -500,8 +501,7 @@ class ActionHandler extends AbstractHandler
             return $result;
         }
 
-        /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
-        $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
+        $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
         $dataHandler->start([], $cmdMapArray);
         $dataHandler->process_cmdmap();
 
@@ -694,7 +694,7 @@ class ActionHandler extends AbstractHandler
         }
 
         $result = [];
-        $allRecipients = $this->getStageService()->getResponsibleBeUser($stageRecord);
+        $allRecipients = $this->stageService->getResponsibleBeUser($stageRecord);
         $preselectedRecipients = $this->stageService->getPreselectedRecipients($stageRecord);
         $isPreselectionChangeable = $stageRecord->isPreselectionChangeable();
 
@@ -727,23 +727,10 @@ class ActionHandler extends AbstractHandler
      */
     protected function getDefaultCommentOfStage($stage)
     {
-        $result = $this->getStageService()->getPropertyOfCurrentWorkspaceStage($stage, 'default_mailcomment');
+        $result = $this->stageService->getPropertyOfCurrentWorkspaceStage($stage, 'default_mailcomment');
         return $result;
     }
 
-    /**
-     * Gets an instance of the Stage service.
-     *
-     * @return StagesService
-     */
-    protected function getStageService()
-    {
-        if (!isset($this->stageService)) {
-            $this->stageService = GeneralUtility::makeInstance(StagesService::class);
-        }
-        return $this->stageService;
-    }
-
     /**
      * Send all available workspace records to the previous stage.
      *
@@ -761,7 +748,7 @@ class ActionHandler extends AbstractHandler
             $recursionLevel = 0,
             $selectionType = 'tables_modify'
         );
-        list($currentStage, $previousStage) = $this->getStageService()->getPreviousStageForElementCollection($workspaceItemsArray);
+        list($currentStage, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
         // get only the relevant items for processing
         $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
             $this->stageService->getWorkspaceId(),
@@ -796,7 +783,7 @@ class ActionHandler extends AbstractHandler
             $recursionLevel = 0,
             $selectionType = 'tables_modify'
         );
-        list($currentStage, $nextStage) = $this->getStageService()->getNextStageForElementCollection($workspaceItemsArray);
+        list($currentStage, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray);
         // get only the relevant items for processing
         $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
             $this->stageService->getWorkspaceId(),
@@ -823,9 +810,7 @@ class ActionHandler extends AbstractHandler
      */
     public function updateStageChangeButtons($id)
     {
-        /** @var StagesService $stageService */
         $stageService = GeneralUtility::makeInstance(StagesService::class);
-        /** @var WorkspaceService $workspaceService */
         $workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
         // fetch the next and previous stage
         $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
@@ -839,7 +824,6 @@ class ActionHandler extends AbstractHandler
         list(, $nextStage) = $stageService->getNextStageForElementCollection($workspaceItemsArray);
         list(, $previousStage) = $stageService->getPreviousStageForElementCollection($workspaceItemsArray);
 
-        /** @var StandaloneView $view */
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $extensionPath = ExtensionManagementUtility::extPath('workspaces');
         $view->setPartialRootPaths(['default' => $extensionPath . 'Resources/Private/Partials']);
@@ -862,7 +846,7 @@ class ActionHandler extends AbstractHandler
     /**
      * @param int $workspaceId
      * @return int Id of the original workspace
-     * @throws \TYPO3\CMS\Core\Exception
+     * @throws Exception
      */
     protected function setTemporaryWorkspace($workspaceId)
     {
@@ -871,7 +855,7 @@ class ActionHandler extends AbstractHandler
 
         if ($currentWorkspace !== $workspaceId) {
             if (!$this->getBackendUser()->setTemporaryWorkspace($workspaceId)) {
-                throw new \TYPO3\CMS\Core\Exception(
+                throw new Exception(
                     'Cannot set temporary workspace to "' . $workspaceId . '"',
                     1371484524
                 );
@@ -882,7 +866,7 @@ class ActionHandler extends AbstractHandler
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+     * @return BackendUserAuthentication
      */
     protected function getBackendUser()
     {
index d3d0c9b..8cc3fb6 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Workspaces\Controller\Remote;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
+
 /**
  * Class MassActionHandler
  * Class encapsulates all actions which are triggered for all elements within the current workspace.
@@ -41,7 +43,7 @@ class MassActionHandler extends AbstractHandler
         $currentWorkspace = $this->getCurrentWorkspace();
         $massActionsEnabled = $GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.enableMassActions') !== '0';
         // in case we're working within "All Workspaces" we can't provide Mass Actions
-        if ($currentWorkspace != \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES && $massActionsEnabled) {
+        if ($currentWorkspace != WorkspaceService::SELECT_ALL_WORKSPACES && $massActionsEnabled) {
             $publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($currentWorkspace);
             if ($publishAccess && !($GLOBALS['BE_USER']->workspaceRec['publish_access'] & 1)) {
                 $actions[] = ['action' => 'publish', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_publish')];
@@ -49,7 +51,7 @@ class MassActionHandler extends AbstractHandler
                     $actions[] = ['action' => 'swap', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_swap')];
                 }
             }
-            if ($currentWorkspace !== \TYPO3\CMS\Workspaces\Service\WorkspaceService::LIVE_WORKSPACE_ID) {
+            if ($currentWorkspace !== WorkspaceService::LIVE_WORKSPACE_ID) {
                 $actions[] = ['action' => 'discard', 'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':label_doaction_discard')];
             }
         }
index 61207c8..90f1a5c 100644 (file)
@@ -27,7 +27,6 @@ use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Utility\DiffUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Workspaces\Service\GridDataService;
 use TYPO3\CMS\Workspaces\Service\HistoryService;
@@ -119,7 +118,6 @@ class RemoteServer extends AbstractHandler
         $diffReturnArray = [];
         $liveReturnArray = [];
         $diffUtility = $this->getDifferenceHandler();
-        /** @var $parseObj RteHtmlParser */
         $parseObj = GeneralUtility::makeInstance(RteHtmlParser::class);
         $liveRecord = BackendUtility::getRecord($parameter->table, $parameter->t3ver_oid);
         $versionRecord = BackendUtility::getRecord($parameter->table, $parameter->uid);
@@ -504,12 +502,4 @@ class RemoteServer extends AbstractHandler
         }
         return $this->differenceHandler;
     }
-
-    /**
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected function getObjectManager()
-    {
-        return GeneralUtility::makeInstance(ObjectManager::class);
-    }
 }
index 70143ee..35f5f9e 100644 (file)
@@ -145,7 +145,6 @@ class ReviewController extends ActionController
         $backendUser = $this->getBackendUser();
         $moduleTemplate = $this->view->getModuleTemplate();
 
-        /** @var WorkspaceService $wsService */
         $wsService = GeneralUtility::makeInstance(WorkspaceService::class);
         if (GeneralUtility::_GP('id')) {
             $pageRecord = BackendUtility::getRecord('pages', GeneralUtility::_GP('id'));
@@ -324,7 +323,6 @@ class ReviewController extends ActionController
             $this->uriBuilder->reset()->uriFor('fullIndex');
             $parameters = array_merge($parameters, $this->uriBuilder->getArguments());
         }
-        /** @var UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         return (string)$uriBuilder->buildUriFromRoute('web_WorkspacesWorkspaces', $parameters);
     }
index 7028053..b608ed4 100644 (file)
@@ -15,8 +15,15 @@ namespace TYPO3\CMS\Workspaces\DataHandler;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Workspaces\Dependency\DependencyResolver;
 use TYPO3\CMS\Workspaces\Dependency\ElementEntity;
+use TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor;
+use TYPO3\CMS\Workspaces\Dependency\EventCallback;
+use TYPO3\CMS\Workspaces\Hook\DataHandlerHook;
 
 /**
  * Handles the \TYPO3\CMS\Core\DataHandling\DataHandler command map and is
@@ -36,12 +43,12 @@ class CommandMap
     const KEY_TransformDependentElementsToUseLiveId = 'KEY_TransformDependentElementsToUseLiveId';
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Hook\DataHandlerHook
+     * @var DataHandlerHook
      */
     protected $parent;
 
     /**
-     * @var \TYPO3\CMS\Core\DataHandling\DataHandler
+     * @var DataHandler
      */
     protected $tceMain;
 
@@ -71,19 +78,19 @@ class CommandMap
     protected $scopes;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor
+     * @var ElementEntityProcessor
      */
     protected $elementEntityProcessor;
 
     /**
      * Creates this object.
      *
-     * @param \TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent
-     * @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
+     * @param DataHandlerHook $parent
+     * @param DataHandler $tceMain
      * @param array $commandMap
      * @param int $workspace
      */
-    public function __construct(\TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent, \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain, array $commandMap, $workspace)
+    public function __construct(DataHandlerHook $parent, DataHandler $tceMain, array $commandMap, $workspace)
     {
         $this->setParent($parent);
         $this->setTceMain($tceMain);
@@ -108,7 +115,7 @@ class CommandMap
      * Sets the command map.
      *
      * @param array $commandMap
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @return CommandMap
      */
     public function set(array $commandMap)
     {
@@ -119,7 +126,7 @@ class CommandMap
     /**
      * Gets the parent object.
      *
-     * @return \TYPO3\CMS\Workspaces\Hook\DataHandlerHook
+     * @return DataHandlerHook
      */
     public function getParent()
     {
@@ -129,10 +136,10 @@ class CommandMap
     /**
      * Sets the parent object.
      *
-     * @param \TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @param DataHandlerHook $parent
+     * @return CommandMap
      */
-    public function setParent(\TYPO3\CMS\Workspaces\Hook\DataHandlerHook $parent)
+    public function setParent(DataHandlerHook $parent)
     {
         $this->parent = $parent;
         return $this;
@@ -141,7 +148,7 @@ class CommandMap
     /**
      * Gets the parent object.
      *
-     * @return \TYPO3\CMS\Core\DataHandling\DataHandler
+     * @return DataHandler
      */
     public function getTceMain()
     {
@@ -151,10 +158,10 @@ class CommandMap
     /**
      * Sets the parent object.
      *
-     * @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @param DataHandler $tceMain
+     * @return CommandMap
      */
-    public function setTceMain(\TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
+    public function setTceMain(DataHandler $tceMain)
     {
         $this->tceMain = $tceMain;
         return $this;
@@ -185,7 +192,7 @@ class CommandMap
      * (see options.workspaces.swapMode).
      *
      * @param string $workspacesSwapMode
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @return CommandMap
      */
     public function setWorkspacesSwapMode($workspacesSwapMode)
     {
@@ -198,7 +205,7 @@ class CommandMap
      * see options.workspaces.changeStageMode)
      *
      * @param string $workspacesChangeStageMode
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @return CommandMap
      */
     public function setWorkspacesChangeStageMode($workspacesChangeStageMode)
     {
@@ -209,14 +216,12 @@ class CommandMap
     /**
      * Gets the element entity processor.
      *
-     * @return \TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor
+     * @return ElementEntityProcessor
      */
     protected function getElementEntityProcessor()
     {
         if (!isset($this->elementEntityProcessor)) {
-            $this->elementEntityProcessor = GeneralUtility::makeInstance(
-                \TYPO3\CMS\Workspaces\Dependency\ElementEntityProcessor::class
-            );
+            $this->elementEntityProcessor = GeneralUtility::makeInstance(ElementEntityProcessor::class);
             $this->elementEntityProcessor->setWorkspace($this->getWorkspace());
         }
         return $this->elementEntityProcessor;
@@ -225,7 +230,7 @@ class CommandMap
     /**
      * Processes the command map.
      *
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @return CommandMap
      */
     public function process()
     {
@@ -248,7 +253,7 @@ class CommandMap
             foreach ($liveIdCollection as $liveId => $commandCollection) {
                 foreach ($commandCollection as $command => $properties) {
                     if ($command === 'version' && isset($properties['action']) && $properties['action'] === 'swap') {
-                        if (isset($properties['swapWith']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($properties['swapWith'])) {
+                        if (isset($properties['swapWith']) && MathUtility::canBeInterpretedAsInteger($properties['swapWith'])) {
                             call_user_func_array([$this, $callbackMethod], array_merge($arguments, [$table, $liveId, $properties]));
                         }
                     }
@@ -303,12 +308,12 @@ class CommandMap
     /**
      * Adds workspaces elements for swapping/publishing.
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
+     * @param DependencyResolver $dependency
      * @param string $table
      * @param int $liveId
      * @param array $properties
      */
-    protected function addWorkspacesSwapElements(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $table, $liveId, array $properties)
+    protected function addWorkspacesSwapElements(DependencyResolver $dependency, $table, $liveId, array $properties)
     {
         $elementList = [];
         // Fetch accordant elements if the swapMode is 'any' or 'pages':
@@ -338,7 +343,7 @@ class CommandMap
             foreach ($versionIdCollection as $versionIdList => $commandCollection) {
                 foreach ($commandCollection as $command => $properties) {
                     if ($command === 'version' && isset($properties['action']) && $properties['action'] === 'setStage') {
-                        if (isset($properties['stageId']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($properties['stageId'])) {
+                        if (isset($properties['stageId']) && MathUtility::canBeInterpretedAsInteger($properties['stageId'])) {
                             call_user_func_array([$this, $callbackMethod], array_merge($arguments, [$table, $versionIdList, $properties]));
                         }
                     }
@@ -408,12 +413,12 @@ class CommandMap
     /**
      * Adds workspaces elements for staging.
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
+     * @param DependencyResolver $dependency
      * @param string $table
      * @param string $versionId
      * @param array $properties
      */
-    protected function addWorkspacesSetStageElements(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $table, $versionId, array $properties)
+    protected function addWorkspacesSetStageElements(DependencyResolver $dependency, $table, $versionId, array $properties)
     {
         $dependency->addElement($table, $versionId, ['versionId' => $versionId, 'properties' => $properties]);
     }
@@ -468,10 +473,10 @@ class CommandMap
      * Applies the workspaces dependencies and removes incomplete structures or automatically
      * completes them
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
+     * @param DependencyResolver $dependency
      * @param string $scope
      */
-    protected function applyWorkspacesDependencies(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency, $scope)
+    protected function applyWorkspacesDependencies(DependencyResolver $dependency, $scope)
     {
         $transformDependentElementsToUseLiveId = $this->getScopeData($scope, self::KEY_TransformDependentElementsToUseLiveId);
         $elementsToBeVersioned = $dependency->getElements();
@@ -533,7 +538,7 @@ class CommandMap
      */
     protected function mergeToTop(array $commandMap)
     {
-        \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($commandMap, $this->commandMap);
+        ArrayUtility::mergeRecursiveWithOverrule($commandMap, $this->commandMap);
         $this->commandMap = $commandMap;
     }
 
@@ -544,7 +549,7 @@ class CommandMap
      */
     protected function mergeToBottom(array $commandMap)
     {
-        \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->commandMap, $commandMap);
+        ArrayUtility::mergeRecursiveWithOverrule($this->commandMap, $commandMap);
     }
 
     /**
@@ -680,12 +685,11 @@ class CommandMap
      * Gets an instance of the depency resolver utility.
      *
      * @param string $scope Scope identifier
-     * @return \TYPO3\CMS\Workspaces\Dependency\DependencyResolver
+     * @return DependencyResolver
      */
     protected function getDependencyUtility($scope)
     {
-        /** @var $dependency \TYPO3\CMS\Workspaces\Dependency\DependencyResolver */
-        $dependency = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver::class);
+        $dependency = GeneralUtility::makeInstance(DependencyResolver::class);
         $dependency->setWorkspace($this->getWorkspace());
         $dependency->setOuterMostParentsRequireReferences(true);
         if ($this->getScopeData($scope, self::KEY_ElementConstructCallback)) {
@@ -782,12 +786,12 @@ class CommandMap
      *
      * @param string $method
      * @param array $targetArguments
-     * @return \TYPO3\CMS\Workspaces\Dependency\EventCallback
+     * @return EventCallback
      */
     protected function getDependencyCallback($method, array $targetArguments = [])
     {
         return GeneralUtility::makeInstance(
-            \TYPO3\CMS\Workspaces\Dependency\EventCallback::class,
+            EventCallback::class,
             $this->getElementEntityProcessor(),
             $method,
             $targetArguments
index 95e90ca..f2fb656 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Workspaces\Dependency;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Object to create and keep track of element or reference entities.
  */
@@ -35,13 +37,12 @@ class DependencyEntityFactory
      * @param string $table
      * @param int $id
      * @param array $data (optional)
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
-     * @return \TYPO3\CMS\Workspaces\Dependency\ElementEntity
+     * @param DependencyResolver $dependency
+     * @return ElementEntity
      */
-    public function getElement($table, $id, array $data = [], \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency)
+    public function getElement($table, $id, array $data = [], DependencyResolver $dependency)
     {
-        /** @var $element ElementEntity */
-        $element = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Dependency\ElementEntity::class, $table, $id, $data, $dependency);
+        $element = GeneralUtility::makeInstance(ElementEntity::class, $table, $id, $data, $dependency);
         $elementName = $element->__toString();
         if (!isset($this->elements[$elementName])) {
             $this->elements[$elementName] = $element;
@@ -52,15 +53,15 @@ class DependencyEntityFactory
     /**
      * Gets and registers a new reference.
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\ElementEntity $element
+     * @param ElementEntity $element
      * @param string $field
-     * @return \TYPO3\CMS\Workspaces\Dependency\ReferenceEntity
+     * @return ReferenceEntity
      */
-    public function getReference(\TYPO3\CMS\Workspaces\Dependency\ElementEntity $element, $field)
+    public function getReference(ElementEntity $element, $field)
     {
         $referenceName = $element->__toString() . '.' . $field;
         if (!isset($this->references[$referenceName][$field])) {
-            $this->references[$referenceName][$field] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Dependency\ReferenceEntity::class, $element, $field);
+            $this->references[$referenceName][$field] = GeneralUtility::makeInstance(ReferenceEntity::class, $element, $field);
         }
         return $this->references[$referenceName][$field];
     }
@@ -72,12 +73,12 @@ class DependencyEntityFactory
      * @param int $id
      * @param string $field
      * @param array $data (optional)
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
-     * @return \TYPO3\CMS\Workspaces\Dependency\ReferenceEntity
+     * @param DependencyResolver $dependency
+     * @return ReferenceEntity
      * @see getElement
      * @see getReference
      */
-    public function getReferencedElement($table, $id, $field, array $data = [], \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency)
+    public function getReferencedElement($table, $id, $field, array $data = [], DependencyResolver $dependency)
     {
         return $this->getReference($this->getElement($table, $id, $data, $dependency), $field);
     }
index 01eaf93..d2f2ecd 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Workspaces\Dependency;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Object to handle and determine dependent references of elements.
  */
@@ -25,7 +27,7 @@ class DependencyResolver
     protected $workspace = 0;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Dependency\DependencyEntityFactory
+     * @var DependencyEntityFactory
      */
     protected $factory;
 
@@ -73,10 +75,10 @@ class DependencyResolver
      * Sets a callback for a particular event.
      *
      * @param string $eventName
-     * @param \TYPO3\CMS\Workspaces\Dependency\EventCallback $callback
-     * @return \TYPO3\CMS\Workspaces\Dependency\DependencyResolver
+     * @param EventCallback $callback
+     * @return DependencyResolver
      */
-    public function setEventCallback($eventName, \TYPO3\CMS\Workspaces\Dependency\EventCallback $callback)
+    public function setEventCallback($eventName, EventCallback $callback)
     {
         $this->eventCallbacks[$eventName] = $callback;
         return $this;
@@ -93,7 +95,7 @@ class DependencyResolver
     public function executeEventCallback($eventName, $caller, array $callerArguments = [])
     {
         if (isset($this->eventCallbacks[$eventName])) {
-            /** @var $callback \TYPO3\CMS\Workspaces\Dependency\EventCallback */
+            /** @var $callback EventCallback */
             $callback = $this->eventCallbacks[$eventName];
             return $callback->execute($callerArguments, $caller, $eventName);
         }
@@ -104,7 +106,7 @@ class DependencyResolver
      * Sets the condition that outermost parents required at least one child or parent reference.
      *
      * @param bool $outerMostParentsRequireReferences
-     * @return \TYPO3\CMS\Workspaces\Dependency\DependencyResolver
+     * @return DependencyResolver
      */
     public function setOuterMostParentsRequireReferences($outerMostParentsRequireReferences)
     {
@@ -118,7 +120,7 @@ class DependencyResolver
      * @param string $table
      * @param int $id
      * @param array $data
-     * @return \TYPO3\CMS\Workspaces\Dependency\ElementEntity
+     * @return ElementEntity
      */
     public function addElement($table, $id, array $data = [])
     {
@@ -131,13 +133,13 @@ class DependencyResolver
     /**
      * Gets the outermost parents that define complete dependent structure each.
      *
-     * @return array|\TYPO3\CMS\Workspaces\Dependency\ElementEntity[]
+     * @return array|ElementEntity[]
      */
     public function getOuterMostParents()
     {
         if (!isset($this->outerMostParents)) {
             $this->outerMostParents = [];
-            /** @var $element \TYPO3\CMS\Workspaces\Dependency\ElementEntity */
+            /** @var $element ElementEntity */
             foreach ($this->elements as $element) {
                 $this->processOuterMostParent($element);
             }
@@ -148,9 +150,9 @@ class DependencyResolver
     /**
      * Processes and registers the outermost parents accordant to the registered elements.
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\ElementEntity $element
+     * @param ElementEntity $element
      */
-    protected function processOuterMostParent(\TYPO3\CMS\Workspaces\Dependency\ElementEntity $element)
+    protected function processOuterMostParent(ElementEntity $element)
     {
         if ($this->outerMostParentsRequireReferences === false || $element->hasReferences()) {
             $outerMostParent = $element->getOuterMostParent();
@@ -167,10 +169,10 @@ class DependencyResolver
      * Gets all nested elements (including the parent) of a particular outermost parent element.
      *
      * @throws \RuntimeException
-     * @param \TYPO3\CMS\Workspaces\Dependency\ElementEntity $outerMostParent
+     * @param ElementEntity $outerMostParent
      * @return array
      */
-    public function getNestedElements(\TYPO3\CMS\Workspaces\Dependency\ElementEntity $outerMostParent)
+    public function getNestedElements(ElementEntity $outerMostParent)
     {
         $outerMostParentName = $outerMostParent->__toString();
         if (!isset($this->outerMostParents[$outerMostParentName])) {
@@ -193,12 +195,12 @@ class DependencyResolver
     /**
      * Gets an instance of the factory to keep track of element or reference entities.
      *
-     * @return \TYPO3\CMS\Workspaces\Dependency\DependencyEntityFactory
+     * @return DependencyEntityFactory
      */
     public function getFactory()
     {
         if (!isset($this->factory)) {
-            $this->factory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Dependency\DependencyEntityFactory::class);
+            $this->factory = GeneralUtility::makeInstance(DependencyEntityFactory::class);
         }
         return $this->factory;
     }
index b3e40fe..a1e3830 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Workspaces\Dependency;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -54,7 +55,7 @@ class ElementEntity
     protected $record;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Dependency\DependencyResolver
+     * @var DependencyResolver
      */
     protected $dependency;
 
@@ -74,7 +75,7 @@ class ElementEntity
     protected $traversingParents = false;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Dependency\ElementEntity
+     * @var ElementEntity
      */
     protected $outerMostParent;
 
@@ -89,9 +90,9 @@ class ElementEntity
      * @param string $table
      * @param int $id
      * @param array $data (optional)
-     * @param \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency
+     * @param DependencyResolver $dependency
      */
-    public function __construct($table, $id, array $data = [], \TYPO3\CMS\Workspaces\Dependency\DependencyResolver $dependency)
+    public function __construct($table, $id, array $data = [], DependencyResolver $dependency)
     {
         $this->table = $table;
         $this->id = (int)$id;
@@ -206,7 +207,7 @@ class ElementEntity
     /**
      * Gets the parent dependency object.
      *
-     * @return \TYPO3\CMS\Workspaces\Dependency\DependencyResolver
+     * @return DependencyResolver
      */
     public function getDependency()
     {
@@ -361,10 +362,10 @@ class ElementEntity
                 $this->outerMostParent = $this;
             } else {
                 $this->outerMostParent = false;
-                /** @var $parent \TYPO3\CMS\Workspaces\Dependency\ReferenceEntity */
+                /** @var $parent ReferenceEntity */
                 foreach ($parents as $parent) {
                     $outerMostParent = $parent->getElement()->getOuterMostParent();
-                    if ($outerMostParent instanceof \TYPO3\CMS\Workspaces\Dependency\ElementEntity) {
+                    if ($outerMostParent instanceof ElementEntity) {
                         $this->outerMostParent = $outerMostParent;
                         break;
                     }
@@ -387,7 +388,7 @@ class ElementEntity
         if (!isset($this->nestedChildren)) {
             $this->nestedChildren = [];
             $children = $this->getChildren();
-            /** @var $child \TYPO3\CMS\Workspaces\Dependency\ReferenceEntity */
+            /** @var $child ReferenceEntity */
             foreach ($children as $child) {
                 $this->nestedChildren = array_merge($this->nestedChildren, [$child->getElement()->__toString() => $child->getElement()], $child->getElement()->getNestedChildren());
             }
index 53d8b1e..c4a2c92 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Workspaces\Dependency;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
 
@@ -29,7 +30,7 @@ class ElementEntityProcessor
     protected $workspace;
 
     /**
-     * @var \TYPO3\CMS\Core\DataHandling\DataHandler
+     * @var DataHandler
      */
     protected $dataHandler;
 
@@ -54,12 +55,12 @@ class ElementEntityProcessor
     }
 
     /**
-     * @return \TYPO3\CMS\Core\DataHandling\DataHandler
+     * @return DataHandler
      */
     public function getDataHandler()
     {
         if (!isset($this->dataHandler)) {
-            $this->dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
+            $this->dataHandler = GeneralUtility::makeInstance(DataHandler::class);
         }
         return $this->dataHandler;
     }
@@ -105,7 +106,7 @@ class ElementEntityProcessor
      *
      * @param array $callerArguments
      * @param array $targetArgument
-     * @param \TYPO3\CMS\Workspaces\Dependency\ElementEntity $caller
+     * @param ElementEntity $caller
      * @param string $eventName
      * @return string|null Skip response (if required)
      */
index e2256ef..6c853cc 100644 (file)
@@ -20,7 +20,7 @@ namespace TYPO3\CMS\Workspaces\Dependency;
 class ReferenceEntity
 {
     /**
-     * @var \TYPO3\CMS\Workspaces\Dependency\ElementEntity
+     * @var ElementEntity
      */
     protected $element;
 
@@ -32,10 +32,10 @@ class ReferenceEntity
     /**
      * Creates this object.
      *
-     * @param \TYPO3\CMS\Workspaces\Dependency\ElementEntity $element
+     * @param ElementEntity $element
      * @param string $field
      */
-    public function __construct(\TYPO3\CMS\Workspaces\Dependency\ElementEntity $element, $field)
+    public function __construct(ElementEntity $element, $field)
     {
         $this->element = $element;
         $this->field = $field;
@@ -44,7 +44,7 @@ class ReferenceEntity
     /**
      * Gets the elements.
      *
-     * @return \TYPO3\CMS\Workspaces\Dependency\ElementEntity
+     * @return ElementEntity
      */
     public function getElement()
     {
index 24ae0d5..e63bf00 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Workspaces\Domain\Model;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Combined record class
  */
@@ -25,12 +27,12 @@ class CombinedRecord
     protected $table;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @var DatabaseRecord
      */
     protected $versionRecord;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @var DatabaseRecord
      */
     protected $liveRecord;
 
@@ -40,13 +42,13 @@ class CombinedRecord
      * @param string $table Name of the database table
      * @param int $liveId Id of the database live-record row
      * @param int $versionId Id of the datbase version-record row
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord
+     * @return CombinedRecord
      */
     public static function create($table, $liveId, $versionId)
     {
         $liveRecord = DatabaseRecord::create($table, $liveId);
         $versionRecord = DatabaseRecord::create($table, $versionId);
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::class, $table, $liveRecord, $versionRecord);
+        return GeneralUtility::makeInstance(CombinedRecord::class, $table, $liveRecord, $versionRecord);
     }
 
     /**
@@ -55,21 +57,21 @@ class CombinedRecord
      * @param string $table Name of the database table
      * @param array $liveRow The relevant datbase live-record row
      * @param array $versionRow The relevant database version-record row
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord
+     * @return CombinedRecord
      */
     public static function createFromArrays($table, array $liveRow, array $versionRow)
     {
         $liveRecord = DatabaseRecord::createFromArray($table, $liveRow);
         $versionRecord = DatabaseRecord::createFromArray($table, $versionRow);
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::class, $table, $liveRecord, $versionRecord);
+        return GeneralUtility::makeInstance(CombinedRecord::class, $table, $liveRecord, $versionRecord);
     }
 
     /**
      * Creates this object.
      *
      * @param string $table
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord $liveRecord
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord $versionRecord
+     * @param DatabaseRecord $liveRecord
+     * @param DatabaseRecord $versionRecord
      */
     public function __construct($table, DatabaseRecord $liveRecord, DatabaseRecord $versionRecord)
     {
@@ -101,7 +103,7 @@ class CombinedRecord
     /**
      * Gets the live-record object.
      *
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @return DatabaseRecord
      */
     public function getLiveRecord()
     {
@@ -111,7 +113,7 @@ class CombinedRecord
     /**
      * Sets the live-record object.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord $liveRecord
+     * @param DatabaseRecord $liveRecord
      */
     public function setLiveRecord(DatabaseRecord $liveRecord)
     {
@@ -121,7 +123,7 @@ class CombinedRecord
     /**
      * Gets the version-record object.
      *
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @return DatabaseRecord
      */
     public function getVersionRecord()
     {
@@ -131,7 +133,7 @@ class CombinedRecord
     /**
      * Sets the version-record object.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord $versionRecord
+     * @param DatabaseRecord $versionRecord
      */
     public function setVersionRecord(DatabaseRecord $versionRecord)
     {
index a20050f..55d628b 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Workspaces\Domain\Model;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Database record class
  */
@@ -39,11 +42,11 @@ class DatabaseRecord
      *
      * @param string $table Name of the database table
      * @param int $uid Id of the datbase record row
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @return DatabaseRecord
      */
     public static function create($table, $uid)
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord::class, $table, $uid);
+        return GeneralUtility::makeInstance(DatabaseRecord::class, $table, $uid);
     }
 
     /**
@@ -51,11 +54,11 @@ class DatabaseRecord
      *
      * @param string $table Name of the database table
      * @param array $row The relevant database record row
-     * @return \TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord
+     * @return DatabaseRecord
      */
     public static function createFromArray($table, array $row)
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord::class, $table, $row['uid'], $row);
+        return GeneralUtility::makeInstance(DatabaseRecord::class, $table, $row['uid'], $row);
     }
 
     /**
@@ -149,7 +152,7 @@ class DatabaseRecord
     protected function loadRow()
     {
         if ($this->row === null) {
-            $this->row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->getTable(), $this->getUid());
+            $this->row = BackendUtility::getRecord($this->getTable(), $this->getUid());
         }
     }
 }
index c4da949..fde0aa9 100644 (file)
@@ -18,7 +18,6 @@ namespace TYPO3\CMS\Workspaces\Hook;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
-use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Workspaces\Service\StagesService;
 use TYPO3\CMS\Workspaces\Service\WorkspaceService;
@@ -26,18 +25,8 @@ use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 /**
  * Befunc service
  */
-class BackendUtilityHook implements SingletonInterface
+class BackendUtilityHook
 {
-    /**
-     * Gets a singleton instance of this object.
-     *
-     * @return BackendUtilityHook
-     */
-    public static function getInstance()
-    {
-        return GeneralUtility::makeInstance(__CLASS__);
-    }
-
     /**
      * Hooks into the \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick and redirects to the workspace preview
      * only if we're in a workspace and if the frontend-preview is disabled.
index 4a2637e..84f31b9 100644 (file)
@@ -17,11 +17,13 @@ namespace TYPO3\CMS\Workspaces\Hook;
 use Doctrine\DBAL\DBALException;
 use Doctrine\DBAL\Platforms\SQLServerPlatform;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Database\ReferenceIndex;
+use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
@@ -29,7 +31,9 @@ use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
+use TYPO3\CMS\Workspaces\DataHandler\CommandMap;
 use TYPO3\CMS\Workspaces\Service\StagesService;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 
 /**
  * Contains some parts for staging, versioning and workspaces
@@ -54,7 +58,7 @@ class DataHandlerHook
     protected $remappedIds = [];
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Service\WorkspaceService
+     * @var WorkspaceService
      */
     protected $workspaceService;
 
@@ -101,7 +105,7 @@ class DataHandlerHook
                         $table,
                         $id,
                         $value['swapWith'],
-                        $value['swapIntoWS'],
+                        (bool)$value['swapIntoWS'],
                         $dataHandler,
                         $comment,
                         true,
@@ -285,14 +289,14 @@ class DataHandlerHook
      * @param string $table
      * @param string $id
      * @param string $value
-     * @param \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler
+     * @param DataHandler $dataHandler
      */
-    public function processCmdmap_postProcess($command, $table, $id, $value, \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler)
+    public function processCmdmap_postProcess($command, $table, $id, $value, DataHandler $dataHandler)
     {
         if ($command === 'delete') {
             if ($table === StagesService::TABLE_STAGE) {
                 $this->resetStageOfElements($id);
-            } elseif ($table === \TYPO3\CMS\Workspaces\Service\WorkspaceService::TABLE_WORKSPACE) {
+            } elseif ($table === WorkspaceService::TABLE_WORKSPACE) {
                 $this->flushWorkspaceElements($id);
             }
         }
@@ -480,7 +484,7 @@ class DataHandlerHook
         }
 
         // Get the new stage title
-        $stageService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\StagesService::class);
+        $stageService = GeneralUtility::makeInstance(StagesService::class);
         $newStage = $stageService->getStageTitle((int)$stageId);
         if (empty($notificationAlternativeRecipients)) {
             // Compile list of recipients:
@@ -593,7 +597,7 @@ class DataHandlerHook
                 '###USER_USERNAME###' => $dataHandler->BE_USER->user['username']
             ];
             // add marker for preview links if workspace extension is loaded
-            $this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
+            $this->workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
             // only generate the link if the marker is in the template - prevents database from getting to much entries
             if (GeneralUtility::isFirstPartOfStr($emailConfig['message'], 'LLL:')) {
                 $tempEmailMessage = $this->getLanguageService()->sL($emailConfig['message']);
@@ -634,8 +638,7 @@ class DataHandlerHook
                     if (!isset($languageObjects[$recipientLanguage])) {
                         // a LANG object in this language hasn't been
                         // instantiated yet, so this is done here
-                        /** @var $languageObject \TYPO3\CMS\Core\Localization\LanguageService */
-                        $languageObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageService::class);
+                        $languageObject = GeneralUtility::makeInstance(LanguageService::class);
                         $languageObject->init($recipientLanguage);
                         $languageObjects[$recipientLanguage] = $languageObject;
                     } else {
@@ -777,7 +780,7 @@ class DataHandlerHook
      * @param bool $notificationEmailInfo Accumulate state changes in memory for compiled notification email?
      * @param array $notificationAlternativeRecipients comma separated list of recipients to notificate instead of normal be_users
      */
-    protected function version_swap($table, $id, $swapWith, $swapIntoWS = 0, DataHandler $dataHandler, $comment = '', $notificationEmailInfo = false, $notificationAlternativeRecipients = [])
+    protected function version_swap($table, $id, $swapWith, $swapIntoWS = false, DataHandler $dataHandler, $comment = '', $notificationEmailInfo = false, $notificationAlternativeRecipients = [])
     {
 
         // Check prerequisites before start swapping
@@ -1073,11 +1076,11 @@ class DataHandlerHook
     /**
      * Writes remapped foreign field (IRRE).
      *
-     * @param \TYPO3\CMS\Core\Database\RelationHandler $dbAnalysis Instance that holds the sorting order of child records
+     * @param RelationHandler $dbAnalysis Instance that holds the sorting order of child records
      * @param array $configuration The TCA field configuration
      * @param int $parentId The uid of the parent record
      */
-    public function writeRemappedForeignField(\TYPO3\CMS\Core\Database\RelationHandler $dbAnalysis, array $configuration, $parentId)
+    public function writeRemappedForeignField(RelationHandler $dbAnalysis, array $configuration, $parentId)
     {
         foreach ($dbAnalysis->itemArray as &$item) {
             if (isset($this->remappedIds[$item['table']][$item['id']])) {
@@ -1319,11 +1322,11 @@ class DataHandlerHook
     }
 
     /**
-     * @return \TYPO3\CMS\Core\DataHandling\DataHandler
+     * @return DataHandler
      */
     protected function getDataHandler()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
+        return GeneralUtility::makeInstance(DataHandler::class);
     }
 
     /**
@@ -1333,9 +1336,9 @@ class DataHandlerHook
      */
     protected function flushWorkspaceCacheEntriesByWorkspaceId($workspaceId)
     {
-        $workspacesCache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('workspaces_cache');
+        $workspacesCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('workspaces_cache');
         $workspacesCache->flushByTag($workspaceId);
-        $workspacesCache->flushByTag(\TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES);
+        $workspacesCache->flushByTag(WorkspaceService::SELECT_ALL_WORKSPACES);
     }
 
     /*******************************
@@ -1658,12 +1661,12 @@ class DataHandlerHook
      * Gets an instance of the command map helper.
      *
      * @param DataHandler $dataHandler DataHandler object
-     * @return \TYPO3\CMS\Workspaces\DataHandler\CommandMap
+     * @return CommandMap
      */
     public function getCommandMap(DataHandler $dataHandler)
     {
         return GeneralUtility::makeInstance(
-            \TYPO3\CMS\Workspaces\DataHandler\CommandMap::class,
+            CommandMap::class,
             $this,
             $dataHandler,
             $dataHandler->cmdmap,
@@ -1695,11 +1698,11 @@ class DataHandlerHook
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Database\RelationHandler
+     * @return RelationHandler
      */
     protected function createRelationHandlerInstance()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
+        return GeneralUtility::makeInstance(RelationHandler::class);
     }
 
     /**
index 538ab74..11273c9 100644 (file)
@@ -14,30 +14,36 @@ namespace TYPO3\CMS\Workspaces\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\SingletonInterface;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Workspaces\ColumnDataProviderInterface;
+use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
+
 /**
  * Service for additional columns in GridPanel
  */
-class AdditionalColumnService implements \TYPO3\CMS\Core\SingletonInterface
+class AdditionalColumnService implements SingletonInterface
 {
     /**
-     * @var array|\TYPO3\CMS\Workspaces\ColumnDataProviderInterface[]
+     * @var array|ColumnDataProviderInterface[]
      */
     protected $columns = [];
 
     /**
-     * @return \TYPO3\CMS\Workspaces\Service\AdditionalColumnService
+     * @return AdditionalColumnService
      */
     public static function getInstance()
     {
-        return self::getObjectManager()->get(\TYPO3\CMS\Workspaces\Service\AdditionalColumnService::class);
+        return self::getObjectManager()->get(AdditionalColumnService::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     public static function getObjectManager()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 
     /**
@@ -52,10 +58,10 @@ class AdditionalColumnService implements \TYPO3\CMS\Core\SingletonInterface
         if (is_object($dataProviderClassOrObject)) {
             $dataProvider = $dataProviderClassOrObject;
         } else {
-            $dataProvider = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($dataProviderClassOrObject);
+            $dataProvider = GeneralUtility::makeInstance($dataProviderClassOrObject);
         }
 
-        if (!$dataProvider instanceof \TYPO3\CMS\Workspaces\ColumnDataProviderInterface) {
+        if (!$dataProvider instanceof ColumnDataProviderInterface) {
             throw new \RuntimeException('Data provider needs to implement ColumnDataProviderInterface', 1374309323);
         }
 
@@ -101,10 +107,10 @@ class AdditionalColumnService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * Gets data for grid data.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $combinedRecord
+     * @param CombinedRecord $combinedRecord
      * @return array Record data
      */
-    public function getData(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $combinedRecord)
+    public function getData(CombinedRecord $combinedRecord)
     {
         $recordData = [];
         foreach ($this->columns as $columnName => $dataProvider) {
index 7e78947..a59e24e 100644 (file)
@@ -14,12 +14,15 @@ namespace TYPO3\CMS\Workspaces\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
 
 /**
  * Service for additional columns in GridPanel
  */
-class AdditionalResourceService implements \TYPO3\CMS\Core\SingletonInterface
+class AdditionalResourceService implements SingletonInterface
 {
     /**
      * @var array
@@ -37,19 +40,19 @@ class AdditionalResourceService implements \TYPO3\CMS\Core\SingletonInterface
     protected $localizationResources = [];
 
     /**
-     * @return \TYPO3\CMS\Workspaces\Service\AdditionalResourceService
+     * @return AdditionalResourceService
      */
     public static function getInstance()
     {
-        return self::getObjectManager()->get(\TYPO3\CMS\Workspaces\Service\AdditionalResourceService::class);
+        return self::getObjectManager()->get(AdditionalResourceService::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     public static function getObjectManager()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 
     /**
@@ -115,6 +118,6 @@ class AdditionalResourceService implements \TYPO3\CMS\Core\SingletonInterface
         $absolutePath = dirname($absoluteFilePath);
         $fileName = basename($absoluteFilePath);
 
-        return \TYPO3\CMS\Core\Utility\PathUtility::getRelativePathTo($absolutePath) . $fileName;
+        return PathUtility::getRelativePathTo($absolutePath) . $fileName;
     }
 }
index 073477c..b5755eb 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Workspaces\Service;
 
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -79,7 +80,7 @@ class AutoPublishService
             )
             ->execute();
 
-        $workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
+        $workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
         while ($rec = $result->fetch()) {
             // First, clear start/end time so it doesn't get select once again:
             $fieldArray = $rec['publish_time'] != 0
@@ -98,7 +99,7 @@ class AutoPublishService
             $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
             // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
             // Execute CMD array:
-            $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
+            $tce = GeneralUtility::makeInstance(DataHandler::class);
             $tce->start([], $cmd);
             $tce->process_cmdmap();
         }
index 86e78d6..b9ceb7e 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Workspaces\Service\Dependency;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Workspaces\Dependency;
 use TYPO3\CMS\Workspaces\Service\GridDataService;
@@ -21,7 +22,7 @@ use TYPO3\CMS\Workspaces\Service\GridDataService;
 /**
  * Service to collect dependent elements.
  */
-class CollectionService implements \TYPO3\CMS\Core\SingletonInterface
+class CollectionService implements SingletonInterface
 {
     /**
      * @var \TYPO3\CMS\Core\DataHandling\DataHandler
@@ -54,7 +55,7 @@ class CollectionService implements \TYPO3\CMS\Core\SingletonInterface
     public function getDependencyResolver()
     {
         if (!isset($this->dependencyResolver)) {
-            $this->dependencyResolver = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Dependency\DependencyResolver::class);
+            $this->dependencyResolver = GeneralUtility::makeInstance(Dependency\DependencyResolver::class);
             $this->dependencyResolver->setOuterMostParentsRequireReferences(true);
             $this->dependencyResolver->setWorkspace($this->getWorkspace());
 
@@ -87,7 +88,7 @@ class CollectionService implements \TYPO3\CMS\Core\SingletonInterface
     protected function getDependencyCallback($method, array $targetArguments = [])
     {
         return GeneralUtility::makeInstance(
-            \TYPO3\CMS\Workspaces\Dependency\EventCallback::class,
+            Dependency\EventCallback::class,
             $this->getElementEntityProcessor(),
             $method,
             $targetArguments
index b45155d..4e519da 100644 (file)
@@ -16,10 +16,15 @@ namespace TYPO3\CMS\Workspaces\Service;
 
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
+use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
+use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
 
 /**
  * Grid data service
@@ -78,7 +83,7 @@ class GridDataService implements LoggerAwareInterface
     protected $systemLanguages;
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Service\IntegrityService
+     * @var IntegrityService
      */
     protected $integrityService;
 
@@ -121,15 +126,13 @@ class GridDataService implements LoggerAwareInterface
     protected function generateDataArray(array $versions, $filterTxt)
     {
         $workspaceAccess = $GLOBALS['BE_USER']->checkWorkspace($GLOBALS['BE_USER']->workspace);
-        $swapStage = $workspaceAccess['publish_access'] & 1 ? \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_ID : 0;
+        $swapStage = $workspaceAccess['publish_access'] & 1 ? StagesService::STAGE_PUBLISH_ID : 0;
         $swapAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace) && $GLOBALS['BE_USER']->workspaceSwapAccess();
         $this->initializeWorkspacesCachingFramework();
-        /** @var IconFactory $iconFactory */
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         // check for dataArray in cache
         if ($this->getDataArrayFromCache($versions, $filterTxt) === false) {
-            /** @var $stagesObj \TYPO3\CMS\Workspaces\Service\StagesService */
-            $stagesObj = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\StagesService::class);
+            $stagesObj = GeneralUtility::makeInstance(StagesService::class);
             $defaultGridColumns = [
                 self::GridColumn_Collection => 0,
                 self::GridColumn_CollectionLevel => 0,
@@ -144,7 +147,7 @@ class GridDataService implements LoggerAwareInterface
                 foreach ($records as $record) {
                     $origRecord = BackendUtility::getRecord($table, $record['t3ver_oid']);
                     $versionRecord = BackendUtility::getRecord($table, $record['uid']);
-                    $combinedRecord = \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::createFromArrays($table, $origRecord, $versionRecord);
+                    $combinedRecord = CombinedRecord::createFromArrays($table, $origRecord, $versionRecord);
                     $this->getIntegrityService()->checkElement($combinedRecord);
 
                     if ($hiddenField !== null) {
@@ -154,7 +157,7 @@ class GridDataService implements LoggerAwareInterface
                     }
 
                     $isDeletedPage = $table === 'pages' && $recordState === 'deleted';
-                    $viewUrl = \TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord($table, $record['uid'], $origRecord, $versionRecord);
+                    $viewUrl = WorkspaceService::viewSingleRecord($table, $record['uid'], $origRecord, $versionRecord);
                     $versionArray = [];
                     $versionArray['table'] = $table;
                     $versionArray['id'] = $table . ':' . $record['uid'];
@@ -172,7 +175,7 @@ class GridDataService implements LoggerAwareInterface
                     $versionArray['value_prevStage'] = (int)$tempStage['uid'];
                     $versionArray['path_Live'] = htmlspecialchars(BackendUtility::getRecordPath($record['livepid'], '', 999));
                     $versionArray['path_Workspace'] = htmlspecialchars(BackendUtility::getRecordPath($record['wspid'], '', 999));
-                    $versionArray['workspace_Title'] = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
+                    $versionArray['workspace_Title'] = htmlspecialchars(WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                     $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                     $versionArray['workspace_Formated_Tstamp'] = BackendUtility::datetime($versionRecord['tstamp']);
                     $versionArray['t3ver_wsid'] = $versionRecord['t3ver_wsid'];
@@ -287,7 +290,7 @@ class GridDataService implements LoggerAwareInterface
      */
     protected function initializeWorkspacesCachingFramework()
     {
-        $this->workspacesCache = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('workspaces_cache');
+        $this->workspacesCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('workspaces_cache');
     }
 
     /**
@@ -594,8 +597,7 @@ class GridDataService implements LoggerAwareInterface
     public function getSystemLanguages()
     {
         if (!isset($this->systemLanguages)) {
-            /** @var $translateTools \TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider */
-            $translateTools = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider::class);
+            $translateTools = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
             $this->systemLanguages = $translateTools->getSystemLanguages();
         }
         return $this->systemLanguages;
@@ -604,12 +606,12 @@ class GridDataService implements LoggerAwareInterface
     /**
      * Gets an instance of the integrity service.
      *
-     * @return \TYPO3\CMS\Workspaces\Service\IntegrityService
+     * @return IntegrityService
      */
     protected function getIntegrityService()
     {
         if (!isset($this->integrityService)) {
-            $this->integrityService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\IntegrityService::class);
+            $this->integrityService = GeneralUtility::makeInstance(IntegrityService::class);
         }
         return $this->integrityService;
     }
@@ -626,39 +628,39 @@ class GridDataService implements LoggerAwareInterface
         // Arguments are always ($this, [method argument], [method argument], ...)
         $signalArguments = $arguments;
         array_unshift($signalArguments, $this);
-        $slotReturn = $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Workspaces\Service\GridDataService::class, $signalName, $signalArguments);
+        $slotReturn = $this->getSignalSlotDispatcher()->dispatch(GridDataService::class, $signalName, $signalArguments);
         return array_slice($slotReturn, 1);
     }
 
     /**
-     * @return \TYPO3\CMS\Workspaces\Service\Dependency\CollectionService
+     * @return Dependency\CollectionService
      */
     protected function getDependencyCollectionService()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\Dependency\CollectionService::class);
+        return GeneralUtility::makeInstance(Dependency\CollectionService::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Workspaces\Service\AdditionalColumnService
+     * @return AdditionalColumnService
      */
     protected function getAdditionalColumnService()
     {
-        return $this->getObjectManager()->get(\TYPO3\CMS\Workspaces\Service\AdditionalColumnService::class);
+        return $this->getObjectManager()->get(AdditionalColumnService::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @return Dispatcher
      */
     protected function getSignalSlotDispatcher()
     {
-        return $this->getObjectManager()->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+        return $this->getObjectManager()->get(Dispatcher::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     protected function getObjectManager()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 }
index 4f2ab88..fe8c244 100644 (file)
@@ -15,13 +15,17 @@ namespace TYPO3\CMS\Workspaces\Service;
  */
 
 use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
+use TYPO3\CMS\Backend\History\RecordHistory;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\CMS\Core\SingletonInterface;
+use TYPO3\CMS\Core\Utility\DiffUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Service for history
  */
-class HistoryService implements \TYPO3\CMS\Core\SingletonInterface
+class HistoryService implements SingletonInterface
 {
     /**
      * @var array
@@ -34,7 +38,7 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface
     protected $historyEntries = [];
 
     /**
-     * @var \TYPO3\CMS\Core\Utility\DiffUtility
+     * @var DiffUtility
      */
     protected $differencesObject;
 
@@ -82,7 +86,6 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface
             $differences = $this->getDifferences($entry);
         }
 
-        /** @var Avatar $avatar */
         $avatar = GeneralUtility::makeInstance(Avatar::class);
         $beUserRecord = BackendUtility::getRecord('be_users', $entry['userid']);
 
@@ -151,8 +154,7 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface
     protected function getHistoryEntries($table, $id)
     {
         if (!isset($this->historyEntries[$table][$id])) {
-            /** @var $historyObject \TYPO3\CMS\Backend\History\RecordHistory */
-            $historyObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\History\RecordHistory::class);
+            $historyObject = GeneralUtility::makeInstance(RecordHistory::class);
             $this->historyEntries[$table][$id] = $historyObject->getHistoryDataForRecord($table, $id);
         }
         return $this->historyEntries[$table][$id];
@@ -161,19 +163,19 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface
     /**
      * Gets an instance of the record differences utility.
      *
-     * @return \TYPO3\CMS\Core\Utility\DiffUtility
+     * @return DiffUtility
      */
     protected function getDifferencesObject()
     {
         if (!isset($this->differencesObject)) {
-            $this->differencesObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\DiffUtility::class);
+            $this->differencesObject = GeneralUtility::makeInstance(DiffUtility::class);
             $this->differencesObject->stripTags = false;
         }
         return $this->differencesObject;
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Localization\LanguageService
+     * @return LanguageService
      */
     protected function getLanguageService()
     {
index fbb89e8..4da282a 100644 (file)
@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Workspaces\Service;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
+use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
+use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
 
 /**
  * Service for integrity
@@ -57,7 +59,7 @@ class IntegrityService
     ];
 
     /**
-     * @var \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord[]
+     * @var CombinedRecord[]
      */
     protected $affectedElements;
 
@@ -80,7 +82,7 @@ class IntegrityService
     /**
      * Sets the affected elements.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord[] $affectedElements
+     * @param CombinedRecord[] $affectedElements
      */
     public function setAffectedElements(array $affectedElements)
     {
@@ -100,9 +102,9 @@ class IntegrityService
     /**
      * Checks a single element.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element
+     * @param CombinedRecord $element
      */
-    public function checkElement(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element)
+    public function checkElement(CombinedRecord $element)
     {
         $this->checkLocalization($element);
     }
@@ -113,9 +115,9 @@ class IntegrityService
      * is new in this workspace (has only a placeholder record in live),
      * then boths (localization and localization parent) should be published.
      *
-     * @param \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element
+     * @param CombinedRecord $element
      */
-    protected function checkLocalization(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord $element)
+    protected function checkLocalization(CombinedRecord $element)
     {
         $table = $element->getTable();
         if (BackendUtility::isTableLocalizable($table)) {
@@ -130,9 +132,9 @@ class IntegrityService
                 if (VersionState::cast($languageParentRecord['t3ver_state'])->equals(VersionState::NEW_PLACEHOLDER)) {
                     $title = BackendUtility::getRecordTitle($table, $versionRow);
                     // Add warning for current versionized record:
-                    $this->addIssue($element->getLiveRecord()->getIdentifier(), self::STATUS_Warning, sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('integrity.dependsOnDefaultLanguageRecord', 'workspaces'), $title));
+                    $this->addIssue($element->getLiveRecord()->getIdentifier(), self::STATUS_Warning, sprintf(LocalizationUtility::translate('integrity.dependsOnDefaultLanguageRecord', 'workspaces'), $title));
                     // Add info for related localization parent record:
-                    $this->addIssue($table . ':' . $languageParentRecord['uid'], self::STATUS_Info, sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('integrity.isDefaultLanguageRecord', 'workspaces'), $title));
+                    $this->addIssue($table . ':' . $languageParentRecord['uid'], self::STATUS_Info, sprintf(LocalizationUtility::translate('integrity.isDefaultLanguageRecord', 'workspaces'), $title));
                 }
             }
         }
index 9ea0b12..5ff6e05 100644 (file)
@@ -15,13 +15,14 @@ namespace TYPO3\CMS\Workspaces\Service;
  */
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Workspaces\Domain\Model\DatabaseRecord;
 
 /**
  * Service for records
  */
-class RecordService implements \TYPO3\CMS\Core\SingletonInterface
+class RecordService implements SingletonInterface
 {
     /**
      * @var DatabaseRecord[]
index 40b626d..923ba46 100644 (file)
@@ -15,8 +15,10 @@ namespace TYPO3\CMS\Workspaces\Service;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Workspaces\Domain\Record\StageRecord;
@@ -25,7 +27,7 @@ use TYPO3\CMS\Workspaces\Domain\Record\WorkspaceRecord;
 /**
  * Stages service
  */
-class StagesService implements \TYPO3\CMS\Core\SingletonInterface
+class StagesService implements SingletonInterface
 {
     const TABLE_STAGE = 'sys_workspace_stage';
     // if a record is in the "ready to publish" stage STAGE_PUBLISH_ID the nextStage is STAGE_PUBLISH_EXECUTE_ID, this id wont be saved at any time in db
@@ -560,17 +562,15 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface
     private function fetchGroups($grList, $idList = '')
     {
         $cacheKey = md5($grList . $idList);
-        $groupList = [];
         if (isset($this->fetchGroupsCache[$cacheKey])) {
-            $groupList = $this->fetchGroupsCache[$cacheKey];
-        } else {
-            if ($idList === '') {
-                // we're at the beginning of the recursion and therefore we need to reset the userGroups member
-                $this->userGroups = [];
-            }
-            $groupList = $this->fetchGroupsRecursive($grList);
-            $this->fetchGroupsCache[$cacheKey] = $groupList;
+            return $this->fetchGroupsCache[$cacheKey];
+        }
+        if ($idList === '') {
+            // we're at the beginning of the recursion and therefore we need to reset the userGroups member
+            $this->userGroups = [];
         }
+        $groupList = $this->fetchGroupsRecursive($grList);
+        $this->fetchGroupsCache[$cacheKey] = $groupList;
         return $groupList;
     }
 
@@ -743,13 +743,11 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface
     protected function isStageAllowedForUser($stageId)
     {
         $cacheKey = $this->getWorkspaceId() . '_' . $stageId;
-        $isAllowed = false;
         if (isset($this->workspaceStageAllowedCache[$cacheKey])) {
-            $isAllowed = $this->workspaceStageAllowedCache[$cacheKey];
-        } else {
-            $isAllowed = $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($stageId);
-            $this->workspaceStageAllowedCache[$cacheKey] = $isAllowed;
+            return $this->workspaceStageAllowedCache[$cacheKey];
         }
+        $isAllowed = $GLOBALS['BE_USER']->workspaceCheckStageForCurrent($stageId);
+        $this->workspaceStageAllowedCache[$cacheKey] = $isAllowed;
         return $isAllowed;
     }
 
@@ -784,7 +782,7 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+     * @return BackendUserAuthentication
      */
     protected function getBackendUser()
     {
index dd4649b..35623f6 100644 (file)
@@ -23,11 +23,13 @@ use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\RootLevelRestriction;
+use TYPO3\CMS\Core\Database\QueryView;
 use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
+use TYPO3\CMS\Workspaces\Hook\PreviewHook;
 
 /**
  * Workspace service
@@ -66,7 +68,6 @@ class WorkspaceService implements SingletonInterface
             $availableWorkspaces[self::LIVE_WORKSPACE_ID] = self::getWorkspaceTitle(self::LIVE_WORKSPACE_ID);
         }
         // add custom workspaces (selecting all, filtering by BE_USER check):
-
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_workspace');
         $queryBuilder->getRestrictions()
             ->add(GeneralUtility::makeInstance(RootLevelRestriction::class));
@@ -152,7 +153,7 @@ class WorkspaceService implements SingletonInterface
             if ($wsid > 0) {
                 $workspaceRec = BackendUtility::getRecord('sys_workspace', $wsid);
                 if ($workspaceRec['publish_access'] & 1) {
-                    $stage = \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_ID;
+                    $stage = StagesService::STAGE_PUBLISH_ID;
                 }
             }
             // Select all versions to swap:
@@ -522,8 +523,7 @@ class WorkspaceService implements SingletonInterface
         // Reusing existing functionality with the drawback that
         // mount points are not covered yet
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW);
-        /** @var $searchObj \TYPO3\CMS\Core\Database\QueryView */
-        $searchObj = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryView::class);
+        $searchObj = GeneralUtility::makeInstance(QueryView::class);
         if ($pageId > 0) {
             $pageList = $searchObj->getTreeList($pageId, $recursionLevel, 0, $perms_clause);
         } else {
@@ -835,7 +835,7 @@ class WorkspaceService implements SingletonInterface
      */
     public function generateWorkspacePreviewLink($uid)
     {
-        $previewObject = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Hook\PreviewHook::class);
+        $previewObject = GeneralUtility::makeInstance(PreviewHook::class);
         $timeToLiveHours = $previewObject->getPreviewLinkLifetime();
         $previewKeyword = $previewObject->compilePreviewKeyword($GLOBALS['BE_USER']->user['uid'], $timeToLiveHours * 3600, $this->getCurrentWorkspace());
         $linkParams = [
@@ -1104,14 +1104,6 @@ class WorkspaceService implements SingletonInterface
         return $queryBuilder;
     }
 
-    /**
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected function getObjectManager()
-    {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
-    }
-
     /**
      * Get the available languages of a certain page
      *
@@ -1121,7 +1113,6 @@ class WorkspaceService implements SingletonInterface
     public function getAvailableLanguages($pageId)
     {
         $languageOptions = [];
-        /** @var \TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider $translationConfigurationProvider */
         $translationConfigurationProvider = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
         $systemLanguages = $translationConfigurationProvider->getSystemLanguages($pageId);