[TASK] Make "$hookObject must implement interface FooInterface" more verbose 77/48177/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 13 May 2016 14:59:05 +0000 (16:59 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 16 May 2016 12:15:33 +0000 (14:15 +0200)
The exceptions show now the affected class that does not
implement the required interface. Where possible, the FQCN
in the exception message string was replaced with the shorter
::class syntax.

Resolves: #76187
Releases: master, 7.6
Change-Id: Id2c290a0cf29bdec5da504a8959996bb747f1c27
Reviewed-on: https://review.typo3.org/48177
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
13 files changed:
typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php
typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/core/Classes/Controller/FileDumpController.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index c0d9c91..f099c09 100644 (file)
@@ -103,7 +103,7 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
                 $hookObject = GeneralUtility::getUserObj($cacheAction);
                 if (!$hookObject instanceof ClearCacheActionsHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
+                    throw new \UnexpectedValueException($cacheAction . ' must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
                 }
                 $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
             }
index 3ec0746..7499a5d 100644 (file)
@@ -228,7 +228,7 @@ class NewContentElementController extends AbstractModule
                     $hookObject = GeneralUtility::getUserObj($classData);
                     if (!$hookObject instanceof NewContentElementWizardHookInterface) {
                         throw new \UnexpectedValueException(
-                            '$hookObject must implement interface ' . NewContentElementWizardHookInterface::class,
+                            $classData . ' must implement interface ' . NewContentElementWizardHookInterface::class,
                             1227834741
                         );
                     }
index d2a5ae6..443975e 100644 (file)
@@ -585,7 +585,7 @@ class InlineRecordContainer extends AbstractContainer
                 foreach ($tceformsInlineHook as $classData) {
                     $processObject = GeneralUtility::getUserObj($classData);
                     if (!$processObject instanceof InlineElementHookInterface) {
-                        throw new \UnexpectedValueException('$processObject must implement interface ' . InlineElementHookInterface::class, 1202072000);
+                        throw new \UnexpectedValueException($classData . ' must implement interface ' . InlineElementHookInterface::class, 1202072000);
                     }
                     $this->hookObjects[] = $processObject;
                 }
index 16e6c6c..ba5240a 100644 (file)
@@ -743,7 +743,7 @@ abstract class AbstractFormElement extends AbstractNode
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['dbFileIcons'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof DatabaseFileIconsHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . DatabaseFileIconsHookInterface::class, 1290167704);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . DatabaseFileIconsHookInterface::class, 1290167704);
                 }
                 $additionalParams = array(
                     'mode' => $mode,
index fe7dbe7..7bd68fe 100644 (file)
@@ -1353,7 +1353,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
             foreach ($drawFooterHooks as $hookClass) {
                 $hookObject = GeneralUtility::getUserObj($hookClass);
                 if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\View\\PageLayoutViewDrawFooterHookInterface', 1404378171);
+                    throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
                 }
                 $hookObject->preProcess($this, $info, $row);
             }
@@ -1560,7 +1560,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
             foreach ($drawItemHooks as $hookClass) {
                 $hookObject = GeneralUtility::getUserObj($hookClass);
                 if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . \TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface::class, 1218547409);
+                    throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);
                 }
                 $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
             }
index 6db01ef..3e298c6 100644 (file)
@@ -77,7 +77,7 @@ class FileDumpController
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'] as $classRef) {
                     $hookObject = GeneralUtility::getUserObj($classRef);
                     if (!$hookObject instanceof FileDumpEIDHookInterface) {
-                        throw new \UnexpectedValueException('FileDump hook object must implement interface ' . FileDumpEIDHookInterface::class, 1394442417);
+                        throw new \UnexpectedValueException($classRef . ' must implement interface ' . FileDumpEIDHookInterface::class, 1394442417);
                     }
                     $hookObject->checkFileAccess($file);
                 }
index 643ec55..1ce4703 100644 (file)
@@ -929,7 +929,7 @@ class DataHandler
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'] as $classData) {
                     $hookObject = GeneralUtility::getUserObj($classData);
                     if (!$hookObject instanceof DataHandlerCheckModifyAccessListHookInterface) {
-                        throw new \UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Core\\DataHandling\\DataHandlerCheckModifyAccessListHookInterface', 1251892472);
+                        throw new \UnexpectedValueException($classData . ' must implement interface ' . DataHandlerCheckModifyAccessListHookInterface::class, 1251892472);
                     }
                     $this->checkModifyAccessListHookObjects[] = $hookObject;
                 }
@@ -2304,7 +2304,7 @@ class DataHandler
                                             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $classRef) {
                                                 $hookObject = GeneralUtility::getUserObj($classRef);
                                                 if (!$hookObject instanceof DataHandlerProcessUploadHookInterface) {
-                                                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Core\\DataHandling\\DataHandlerProcessUploadHookInterface', 1279962349);
+                                                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . DataHandlerProcessUploadHookInterface::class, 1279962349);
                                                 }
                                                 $hookObject->processUpload_postProcessAction($theDestFile, $this);
                                             }
index 27f9320..1b684da 100644 (file)
@@ -323,7 +323,7 @@ class ExtendedFileUtility extends BasicFileUtility
                             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_extfilefunc.php']['processData'] as $classRef) {
                                 $hookObject = GeneralUtility::getUserObj($classRef);
                                 if (!$hookObject instanceof ExtendedFileUtilityProcessDataHookInterface) {
-                                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtilityProcessDataHookInterface', 1279719168);
+                                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . ExtendedFileUtilityProcessDataHookInterface::class, 1279719168);
                                 }
                                 $hookObject->processData_postProcessAction($action, $cmdArr, $result[$action], $this);
                             }
index 546a498..0bfda1b 100644 (file)
@@ -1062,7 +1062,7 @@ class FileList extends AbstractRecordList
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof FileListEditIconHookInterface) {
                     throw new \UnexpectedValueException(
-                        '$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface',
+                        $classData . ' must implement interface ' . FileListEditIconHookInterface::class,
                         1235225797
                     );
                 }
index d458d91..a269c43 100644 (file)
@@ -1202,7 +1202,7 @@ abstract class AbstractMenuContentObject
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/tslib/class.tslib_menu.php']['filterMenuPages'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof AbstractMenuFilterPagesHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . AbstractMenuFilterPagesHookInterface::class, 1269877402);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . AbstractMenuFilterPagesHookInterface::class, 1269877402);
                 }
                 $includePage = $includePage && $hookObject->processFilter($data, $banUidArray, $spacer, $this);
             }
index 4d99f00..2eb30c3 100644 (file)
@@ -197,7 +197,7 @@ class PageRepository
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][PageRepository::class]['init'] as $classRef) {
                 $hookObject = GeneralUtility::makeInstance($classRef);
                 if (!$hookObject instanceof PageRepositoryInitHookInterface) {
-                    throw new \UnexpectedValueException($hookObject . ' must implement interface TYPO3\\CMS\\Frontend\\Page\\PageRepositoryInitHookInterface', 1379579812);
+                    throw new \UnexpectedValueException($hookObject . ' must implement interface ' . PageRepositoryInitHookInterface::class, 1379579812);
                 }
                 $hookObject->init_postProcess($this);
             }
@@ -228,7 +228,7 @@ class PageRepository
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPage'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof PageRepositoryGetPageHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . PageRepositoryGetPageHookInterface::class, 1251476766);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . PageRepositoryGetPageHookInterface::class, 1251476766);
                 }
                 $hookObject->getPage_preProcess($uid, $disableGroupAccessCheck, $this);
             }
@@ -364,7 +364,7 @@ class PageRepository
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPageOverlay'] as $classRef) {
                     $hookObject = GeneralUtility::getUserObj($classRef);
                     if (!$hookObject instanceof PageRepositoryGetPageOverlayHookInterface) {
-                        throw new \UnexpectedValueException('$hookObject must implement interface ' . PageRepositoryGetPageOverlayHookInterface::class, 1269878881);
+                        throw new \UnexpectedValueException($classRef . ' must implement interface ' . PageRepositoryGetPageOverlayHookInterface::class, 1269878881);
                     }
                     $hookObject->getPageOverlay_preProcess($origPage, $lUid, $this);
                 }
@@ -465,7 +465,7 @@ class PageRepository
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof PageRepositoryGetRecordOverlayHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881658);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881658);
                 }
                 $hookObject->getRecordOverlay_preProcess($table, $row, $sys_language_content, $OLmode, $this);
             }
@@ -528,7 +528,7 @@ class PageRepository
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof PageRepositoryGetRecordOverlayHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881659);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . PageRepositoryGetRecordOverlayHookInterface::class, 1269881659);
                 }
                 $hookObject->getRecordOverlay_postProcess($table, $row, $sys_language_content, $OLmode, $this);
             }
index dc7b7d7..93e6151 100755 (executable)
@@ -271,7 +271,7 @@ class AdminPanelView
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'] as $classRef) {
                 $hookObject = GeneralUtility::getUserObj($classRef);
                 if (!$hookObject instanceof AdminPanelViewHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Frontend\\View\\AdminPanelViewHookInterface', 1311942539);
+                    throw new \UnexpectedValueException($classRef . ' must implement interface ' . AdminPanelViewHookInterface::class, 1311942539);
                 }
                 $moduleContent .= $hookObject->extendAdminPanel($moduleContent, $this);
             }
index 6571263..e33edec 100644 (file)
@@ -626,7 +626,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof RecordListGetTableHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListGetTableHookInterface::class, 1195114460);
+                    throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListGetTableHookInterface::class, 1195114460);
                 }
                 $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
             }
@@ -1131,7 +1131,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                             $hookObject = GeneralUtility::getUserObj($classData);
                             if (!$hookObject instanceof RecordListHookInterface) {
-                                throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567850);
+                                throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567850);
                             }
                             $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
                         }
@@ -1253,7 +1253,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof RecordListHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567855);
+                    throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567855);
                 }
                 $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
             }
@@ -1650,7 +1650,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof RecordListHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567840);
+                    throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567840);
                 }
                 $cells = $hookObject->makeControl($table, $row, $cells, $this);
             }
@@ -1812,7 +1812,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof RecordListHookInterface) {
-                    throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567845);
+                    throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567845);
                 }
                 $cells = $hookObject->makeClip($table, $row, $cells, $this);
             }