Commit e3c4d761 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Wouter Wolters
Browse files

[TASK] Make "$hookObject must implement interface FooInterface" more verbose

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/48115

Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 2fc9b4bc
......@@ -86,7 +86,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);
}
......
......@@ -227,7 +227,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
);
}
......
......@@ -587,7 +587,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;
}
......
......@@ -708,7 +708,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,
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -909,7 +909,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;
}
......@@ -2181,7 +2181,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);
}
......
......@@ -295,7 +295,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);
}
......
......@@ -1017,7 +1017,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
);
}
......
......@@ -1200,7 +1200,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);
}
......
......@@ -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);
}
......
......@@ -272,7 +272,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);
}
......
......@@ -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);
}
......@@ -1649,7 +1649,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);
}
......@@ -1811,7 +1811,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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment