[TASK] Use name-resolution instead of strings where possible: 15 71/34871/3
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 1 Dec 2014 13:22:35 +0000 (14:22 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 5 Dec 2014 13:29:33 +0000 (14:29 +0100)
(part for extensions starting with "b" and "c")

Use name-resolution with ...::class instead of strings where
possible.
(needs PHP 5.5, which is meanwhile required for master)

Change-set Iedbb896607adddce2b23ab67f990fa2296c0d1bb
first introduced usage of ::class in master. We now add it
in various more places.

Change-Id: Iaadc5dda5bdcd6408c100fb2ecbbe60cd9707494
Resolves: #63477
Releases: master
Reviewed-on: http://review.typo3.org/34871
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
12 files changed:
typo3/sysext/belog/Classes/Controller/AbstractController.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/HistoryEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryRepositoryTest.php
typo3/sysext/belog/Tests/Unit/Domain/Repository/WorkspaceRepositoryTest.php
typo3/sysext/belog/ext_tables.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Domain/Repository/BackendUserSessionRepositoryTest.php
typo3/sysext/beuser/Tests/Unit/Service/ModuleDataStorageServiceTest.php
typo3/sysext/beuser/ext_localconf.php
typo3/sysext/beuser/ext_tables.php
typo3/sysext/cms/ext_localconf.php
typo3/sysext/cms/ext_tables.php

index 7f630a3..3bc1810 100644 (file)
@@ -207,7 +207,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
         * @return void
         */
        protected function configurePropertyMapperForDateTimeFormat(\TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration $propertyMapperDate) {
-               $propertyMapperDate->setTypeConverterOption('TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\DateTimeConverter', \TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, $this->settings['dateFormat'] . ' ' . $this->settings['timeFormat']);
+               $propertyMapperDate->setTypeConverterOption(\TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::class, \TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, $this->settings['dateFormat'] . ' ' . $this->settings['timeFormat']);
        }
 
        /**
index 46fb53e..0f73280 100644 (file)
@@ -25,9 +25,9 @@ class HistoryEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        protected $querySettings = NULL;
 
        public function setUp() {
-               $this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
-               $this->objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $this->objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($this->querySettings));
+               $this->querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
+               $this->objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+               $this->objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($this->querySettings));
        }
 
        /**
@@ -35,7 +35,7 @@ class HistoryEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function initializeObjectSetsRespectStoragePidToFalse() {
                $this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
-               $fixture = $this->getMock('TYPO3\\CMS\\Belog\\Domain\\Repository\\HistoryEntryRepository', array('setDefaultQuerySettings'), array($this->objectManager));
+               $fixture = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository::class, array('setDefaultQuerySettings'), array($this->objectManager));
                $fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
                $fixture->initializeObject();
        }
index ec52aa3..51420fd 100644 (file)
@@ -24,13 +24,13 @@ class LogEntryRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function initializeObjectSetsRespectStoragePidToFalse() {
                /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings $querySettings */
-               $querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
-               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($querySettings));
-               $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
+               $querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
+               $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+               $objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings));
+               $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', FALSE);
                $querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
                /** @var \TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository|\PHPUnit_Framework_MockObject_MockObject $subject */
-               $subject = $this->getMock('TYPO3\\CMS\\Belog\\Domain\\Repository\\LogEntryRepository', array('setDefaultQuerySettings'), array($objectManager));
+               $subject = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository::class, array('setDefaultQuerySettings'), array($objectManager));
                $subject->expects($this->once())->method('setDefaultQuerySettings')->with($querySettings);
                $subject->initializeObject();
        }
index 0ff41df..a98f6f5 100644 (file)
@@ -23,11 +23,11 @@ class WorkspaceRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function initializeObjectSetsRespectStoragePidToFalse() {
-               $querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
-               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
-               $objectManager->expects($this->any())->method('get')->with('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface')->will($this->returnValue($querySettings));
+               $querySettings = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
+               $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
+               $objectManager->expects($this->any())->method('get')->with(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class)->will($this->returnValue($querySettings));
                $querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(FALSE);
-               $subject = $this->getMock('TYPO3\\CMS\\Belog\\Domain\\Repository\\WorkspaceRepository', array('setDefaultQuerySettings'), array($objectManager));
+               $subject = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository::class, array('setDefaultQuerySettings'), array($objectManager));
                $subject->expects($this->once())->method('setDefaultQuerySettings')->with($querySettings);
                $subject->initializeObject();
        }
index 111c143..e63b52c 100644 (file)
@@ -6,7 +6,7 @@ if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
        // Module Web->Info->Log
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
                'web_info',
-               'TYPO3\\CMS\\Belog\\Module\\BackendLogModuleBootstrap',
+               \TYPO3\CMS\Belog\Module\BackendLogModuleBootstrap::class,
                NULL,
                'Log'
        );
index 1ca77b8..ca359c2 100644 (file)
@@ -23,7 +23,7 @@ class BackendUserRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function classCanBeInstantiated() {
-               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface', array(), array(), '', FALSE);
+               $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class, array(), array(), '', FALSE);
                new \TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository($objectManager);
        }
 }
index 104bf59..8bef3cc 100644 (file)
@@ -23,7 +23,7 @@ class BackendUserSessionRepositoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCas
         * @test
         */
        public function classCanBeInstantiated() {
-               $objectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
+               $objectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
                new \TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository($objectManager);
        }
 }
index cdfbd9e..3e4c8ac 100644 (file)
@@ -25,21 +25,21 @@ class ModuleDataStorageServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function loadModuleDataReturnsModuleDataObjectForEmptyModuleData() {
                // The test calls several static dependencies that can not be mocked and
                // call database in the end, so we need to mock the database here.
-               $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
+               $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', FALSE);
 
                // Simulate empty module data
-               $GLOBALS['BE_USER'] = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array(), array(), '', FALSE);
+               $GLOBALS['BE_USER'] = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class, array(), array(), '', FALSE);
                $GLOBALS['BE_USER']->uc = array();
                $GLOBALS['BE_USER']->uc['moduleData'] = array();
 
                /** @var \TYPO3\CMS\Beuser\Service\ModuleDataStorageService $subject */
-               $subject = $this->getAccessibleMock('TYPO3\\CMS\\Beuser\\Service\\ModuleDataStorageService', array('dummy'), array(), '', FALSE);
-               $objectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array(), array(), '', FALSE);
-               $moduleDataMock = $this->getMock('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData', array(), array(), '', FALSE);
+               $subject = $this->getAccessibleMock(\TYPO3\CMS\Beuser\Service\ModuleDataStorageService::class, array('dummy'), array(), '', FALSE);
+               $objectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class, array(), array(), '', FALSE);
+               $moduleDataMock = $this->getMock(\TYPO3\CMS\Beuser\Domain\Model\ModuleData::class, array(), array(), '', FALSE);
                $objectManagerMock
                        ->expects($this->once())
                        ->method('get')
-                       ->with('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData')
+                       ->with(\TYPO3\CMS\Beuser\Domain\Model\ModuleData::class)
                        ->will($this->returnValue($moduleDataMock));
                $subject->_set('objectManager', $objectManagerMock);
 
index 243f832..2bcbf61 100644 (file)
@@ -1,4 +1,4 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][] = 'TYPO3\\CMS\\Beuser\\Hook\\SwitchBackUserHook->switchBack';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][] = \TYPO3\CMS\Beuser\Hook\SwitchBackUserHook::class . '->switchBack';
index c912643..02d2a67 100644 (file)
@@ -37,5 +37,5 @@ if (TYPO3_MODE === 'BE') {
 
        // Register AJAX Controller
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('PermissionAjaxController::dispatch',
-               'TYPO3\\CMS\\Beuser\\Controller\\PermissionAjaxController->dispatch');
+               \TYPO3\CMS\Beuser\Controller\PermissionAjaxController::class . '->dispatch');
 }
index 12d0bc3..8fea64b 100644 (file)
@@ -179,12 +179,12 @@ mod.wizards.newContentElement {
 ');
 
 // Registering hooks for the treelist cache
-$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'TYPO3\\CMS\\Frontend\\Hooks\\TreelistCacheUpdateHooks';
-$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'TYPO3\\CMS\\Frontend\\Hooks\\TreelistCacheUpdateHooks';
-$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = 'TYPO3\\CMS\\Frontend\\Hooks\\TreelistCacheUpdateHooks';
+$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::class;
+$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::class;
+$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = \TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::class;
 
 // Register search keys
 $GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['page'] = 'pages';
 $GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['content'] = 'tt_content';
 // Register hook to show preview info
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo']['cms'] = 'TYPO3\\CMS\\Frontend\\Hooks\\FrontendHooks->hook_previewInfo';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo']['cms'] = \TYPO3\CMS\Frontend\Hooks\FrontendHooks::class . '->hook_previewInfo';
index 1860057..2465952 100644 (file)
@@ -7,13 +7,13 @@ if (TYPO3_MODE === 'BE') {
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_info', 'EXT:cms/locallang_csh_webinfo.xlf');
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
                'web_info',
-               'TYPO3\\CMS\\Frontend\\Controller\\PageInformationController',
+               \TYPO3\CMS\Frontend\Controller\PageInformationController::class,
                NULL,
                'LLL:EXT:cms/locallang_tca.xlf:mod_tx_cms_webinfo_page'
        );
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction(
                'web_info',
-               'TYPO3\\CMS\\Frontend\\Controller\\TranslationStatusController',
+               \TYPO3\CMS\Frontend\Controller\TranslationStatusController::class,
                NULL,
                'LLL:EXT:cms/locallang_tca.xlf:mod_tx_cms_webinfo_lang'
        );