From: Matthias Schmidt Date: Sat, 21 May 2016 12:13:24 +0000 (+0200) Subject: Add ImplementationException and ParentClassException X-Git-Tag: 3.0.0_Beta_1~1687 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7b9ff46b6e01b2c5e853b17590c0e95584f161d4;p=GitHub%2FWoltLab%2FWCF.git Add ImplementationException and ParentClassException --- diff --git a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php index 8c4f6cabc6..a7dec70ee5 100644 --- a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\action; use wcf\action\AbstractSecureAction; use wcf\action\AJAXInvokeAction; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\worker\IWorker; use wcf\system\WCF; @@ -65,7 +66,7 @@ class WorkerProxyAction extends AJAXInvokeAction { } if (!is_subclass_of($this->className, IWorker::class)) { - throw new SystemException("'".$this->className."' does not implement '".IWorker::class."'"); + throw new ImplementationException($this->className, IWorker::class); } } diff --git a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php index fcb7fe597c..3dd726c479 100644 --- a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php @@ -2,8 +2,10 @@ namespace wcf\action; use wcf\system\exception\AJAXException; use wcf\system\exception\IllegalLinkException; +use wcf\system\exception\ImplementationException; use wcf\system\exception\InvalidSecurityTokenException; use wcf\system\exception\NamedUserException; +use wcf\system\exception\ParentClassException; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; @@ -123,10 +125,10 @@ class AJAXInvokeAction extends AbstractSecureAction { protected function invoke() { // check for interface and inheritance of SingletonFactory if (!is_subclass_of($this->className, IAJAXInvokeAction::class)) { - throw new SystemException("'".$this->className."' does not implement '".IAJAXInvokeAction::class."'"); + throw new ImplementationException($this->className, IAJAXInvokeAction::class); } else if (!is_subclass_of($this->className, SingletonFactory::class)) { - throw new SystemException("'".$this->className."' does not extend '".SingletonFactory::class."'"); + throw new ParentClassException($this->className, SingletonFactory::class); } // validate action name diff --git a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php index d8c8e5bf98..d6e18976f0 100644 --- a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php @@ -1,7 +1,7 @@ className, IDatabaseObjectAction::class)) { - throw new SystemException("'".$this->className."' does not implement '".IDatabaseObjectAction::class."'"); + throw new ImplementationException($this->className, IDatabaseObjectAction::class); } if (!empty($this->interfaceName)) { if (!is_subclass_of($this->className, $this->interfaceName)) { - throw new SystemException("'".$this->className."' does not implement '".$this->interfaceName."'"); + throw new ImplementationException($this->className, $this->interfaceName); } } diff --git a/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php b/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php index 9bc0d4f995..5e5dfa2b6d 100644 --- a/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php +++ b/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php @@ -1,5 +1,6 @@ className."'"); } if (!is_subclass_of($this->className, static::$processorInterface)) { - throw new SystemException("'".$this->className."' does not implement '".static::$processorInterface."'"); + throw new ImplementationException($this->className, static::$processorInterface); } if (is_subclass_of($this->className, SingletonFactory::class)) { @@ -47,7 +48,7 @@ class ProcessibleDatabaseObject extends DatabaseObject { } else { if (!is_subclass_of($this->className, IDatabaseObjectProcessor::class)) { - throw new SystemException("'".$this->className."' does not implement '".IDatabaseObjectProcessor::class."'"); + throw new ImplementationException($this->className, IDatabaseObjectProcessor::class); } $this->processor = new $this->className($this); diff --git a/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php b/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php index 8578899ad8..39d27d5f8e 100644 --- a/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php +++ b/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php @@ -1,6 +1,7 @@ categoryIDs)) { diff --git a/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php b/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php index 1f0af441d0..0bc7949fba 100644 --- a/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php +++ b/wcfsetup/install/files/lib/data/object/type/ObjectType.class.php @@ -4,6 +4,7 @@ use wcf\data\object\type\definition\ObjectTypeDefinition; use wcf\data\ProcessibleDatabaseObject; use wcf\data\TDatabaseObjectOptions; use wcf\data\TDatabaseObjectPermissions; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\SingletonFactory; @@ -87,7 +88,7 @@ class ObjectType extends ProcessibleDatabaseObject { throw new SystemException("Unable to find class '".$this->className."'"); } if (($definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName) && !is_subclass_of($this->className, $definitionInterface)) { - throw new SystemException("'".$this->className."' does not implement '".$definitionInterface."'"); + throw new ImplementationException($this->className, $definitionInterface); } if (is_subclass_of($this->className, SingletonFactory::class)) { diff --git a/wcfsetup/install/files/lib/data/sitemap/Sitemap.class.php b/wcfsetup/install/files/lib/data/sitemap/Sitemap.class.php index 7868b2c1a5..017f84353f 100644 --- a/wcfsetup/install/files/lib/data/sitemap/Sitemap.class.php +++ b/wcfsetup/install/files/lib/data/sitemap/Sitemap.class.php @@ -3,6 +3,7 @@ namespace wcf\data\sitemap; use wcf\data\DatabaseObject; use wcf\data\TDatabaseObjectOptions; use wcf\data\TDatabaseObjectPermissions; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\sitemap\ISitemapProvider; @@ -58,7 +59,7 @@ class Sitemap extends DatabaseObject { } if (!is_subclass_of($this->className, ISitemapProvider::class)) { - throw new SystemException("'".$this->className."' does not implement '".ISitemapProvider::class."'"); + throw new ImplementationException($this->className, ISitemapProvider::class); } $this->sitemapObj = new $this->className(); diff --git a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php index 8add39cfdc..80dfed9587 100644 --- a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php +++ b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php @@ -3,6 +3,7 @@ namespace wcf\data\user\option; use wcf\data\user\User; use wcf\data\DatabaseObjectDecorator; use wcf\system\cache\builder\UserOptionCacheBuilder; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\option\user\IUserOptionOutput; use wcf\util\StringUtil; @@ -78,7 +79,7 @@ class ViewableUserOption extends DatabaseObjectDecorator { // validate interface if (!is_subclass_of($this->outputClass, IUserOptionOutput::class)) { - throw new SystemException("'".$this->outputClass."' does not implement '".IUserOptionOutput::class."'"); + throw new ImplementationException($this->outputClass, IUserOptionOutput::class); } self::$outputObjects[$this->outputClass] = new $this->outputClass(); diff --git a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php index aba58b66ae..1da8b11992 100644 --- a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php @@ -1,5 +1,7 @@ className, SingletonFactory::class)) { - throw new SystemException("'".$this->className."' does not extend '".SingletonFactory::class."'"); + throw new ParentClassException($this->className, SingletonFactory::class); } if (!is_subclass_of($this->className, IUserProfileMenuContent::class)) { - throw new SystemException("'".$this->className."' does not implement '".IUserProfileMenuContent::class."'"); + throw new ImplementationException($this->className, IUserProfileMenuContent::class); } $this->contentManager = call_user_func([$this->className, 'getInstance']); diff --git a/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php b/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php index 277ce1c45e..889d529a20 100644 --- a/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php +++ b/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php @@ -2,6 +2,7 @@ namespace wcf\page; use wcf\data\DatabaseObjectList; use wcf\system\event\EventHandler; +use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; use wcf\system\WCF; @@ -140,7 +141,7 @@ abstract class MultipleLinkPage extends AbstractPage { } if (!is_subclass_of($this->objectListClassName, DatabaseObjectList::class)) { - throw new SystemException("'".$this->objectListClassName."' does not extend '".DatabaseObjectList::class."'"); + throw new ParentClassException($this->objectListClassName, DatabaseObjectList::class); } $this->objectList = new $this->objectListClassName(); diff --git a/wcfsetup/install/files/lib/page/SearchResultPage.class.php b/wcfsetup/install/files/lib/page/SearchResultPage.class.php index 7c95ef4548..0a0680d01b 100644 --- a/wcfsetup/install/files/lib/page/SearchResultPage.class.php +++ b/wcfsetup/install/files/lib/page/SearchResultPage.class.php @@ -5,7 +5,7 @@ use wcf\data\search\Search; use wcf\system\application\ApplicationHandler; use wcf\system\event\EventHandler; use wcf\system\exception\IllegalLinkException; -use wcf\system\exception\SystemException; +use wcf\system\exception\ImplementationException; use wcf\system\page\PageLocationManager; use wcf\system\search\SearchEngine; use wcf\system\WCF; @@ -142,7 +142,7 @@ class SearchResultPage extends MultipleLinkPage { $objectType = SearchEngine::getInstance()->getObjectType($type); if (($message = $objectType->getObject($objectID)) !== null) { if (!($message instanceof ISearchResultObject)) { - throw new SystemException("'".get_class($message)."' does not implement '".ISearchResultObject::class."'"); + throw new ImplementationException(get_class($message), ISearchResultObject::class); } $this->messages[] = $message; diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 2fc6c4dceb..80611c82b9 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -20,6 +20,7 @@ use wcf\system\exception\AJAXException; use wcf\system\exception\ErrorException; use wcf\system\exception\IPrintableException; use wcf\system\exception\NamedUserException; +use wcf\system\exception\ParentClassException; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\SystemException; use wcf\system\language\LanguageFactory; @@ -721,7 +722,7 @@ class WCF { if (class_exists($objectName)) { if (!(is_subclass_of($objectName, SingletonFactory::class))) { - throw new SystemException("class '".$objectName."' does not implement the interface '".SingletonFactory::class."'"); + throw new ParentClassException($objectName, SingletonFactory::class); } self::$coreObject[$className] = call_user_func([$objectName, 'getInstance']); diff --git a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php index 2f417ceb5c..10a5310607 100644 --- a/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php @@ -2,6 +2,7 @@ namespace wcf\system\background; use wcf\data\user\User; use wcf\system\background\job\AbstractBackgroundJob; +use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; use wcf\system\session\SessionHandler; use wcf\system\SingletonFactory; @@ -57,7 +58,7 @@ class BackgroundQueueHandler extends SingletonFactory { if (!is_array($jobs)) $jobs = [$jobs]; foreach ($jobs as $job) { if (!($job instanceof AbstractBackgroundJob)) { - throw new SystemException('$jobs contains an item that does not extend \''.AbstractBackgroundJob::class.'\'.'); + throw new ParentClassException(get_class($job), AbstractBackgroundJob::class); } } diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php index 313d972b63..55c00510e5 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php @@ -1,6 +1,7 @@ listenerClassName, IParameterizedEventListener::class)) { // legacy event listeners if (!is_subclass_of($eventListener->listenerClassName, IEventListener::class)) { - throw new SystemException("'".$eventListener->listenerClassName."' does not implement '".IParameterizedEventListener::class."'"); + throw new ImplementationException($eventListener->listenerClassName, IParameterizedEventListener::class); } } @@ -203,7 +204,7 @@ class EventHandler extends SingletonFactory { if (!is_subclass_of($eventListener->listenerClassName, IParameterizedEventListener::class)) { // legacy event listeners if (!is_subclass_of($eventListener->listenerClassName, IEventListener::class)) { - throw new SystemException("'".$eventListener->listenerClassName."' does not implement '".IParameterizedEventListener::class."'"); + throw new ImplementationException($eventListener->listenerClassName, IParameterizedEventListener::class); } } diff --git a/wcfsetup/install/files/lib/system/exception/ImplementationException.class.php b/wcfsetup/install/files/lib/system/exception/ImplementationException.class.php new file mode 100644 index 0000000000..5eb8b6a816 --- /dev/null +++ b/wcfsetup/install/files/lib/system/exception/ImplementationException.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf + * @subpackage system.exception + * @category Community Framework + * @since 2.2 + */ +class ImplementationException extends \LogicException { + /** + * ImplementationException constructor. + * + * @param string $className + * @param string $interfaceName + */ + public function __construct($className, $interfaceName) { + parent::__construct("Class '{$className}' does not implement interface '{$interfaceName}'."); + } +} diff --git a/wcfsetup/install/files/lib/system/exception/ParentClassException.class.php b/wcfsetup/install/files/lib/system/exception/ParentClassException.class.php new file mode 100644 index 0000000000..8abcf32649 --- /dev/null +++ b/wcfsetup/install/files/lib/system/exception/ParentClassException.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf + * @subpackage system.exception + * @category Community Framework + * @since 2.2 + */ +class ParentClassException extends \LogicException { + /** + * ImplementationException constructor. + * + * @param string $className + * @param string $parentClassName + */ + public function __construct($className, $parentClassName) { + parent::__construct("Class '{$className}' does not extend class '{$parentClassName}'."); + } +} diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php index eaf8401fc9..a3c28b26b2 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php @@ -1,7 +1,5 @@ container = new $containerClassName($parameters['objectID']); if (!empty($containerDecoratorClassName)) { if (!is_subclass_of($containerDecoratorClassName, DatabaseObjectDecorator::class)) { - throw new SystemException("'".$containerDecoratorClassName."' does not extend '".DatabaseObjectDecorator::class."'"); + throw new ParentClassException($containerDecoratorClassName, DatabaseObjectDecorator::class); } $this->container = new $containerDecoratorClassName($this->container); diff --git a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php index 16a98ffb31..8a474b2808 100644 --- a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php @@ -5,6 +5,7 @@ use wcf\data\option\Option; use wcf\system\application\ApplicationHandler; use wcf\system\cache\builder\OptionCacheBuilder; use wcf\system\event\EventHandler; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; @@ -380,7 +381,7 @@ class OptionHandler implements IOptionHandler { } if (!is_subclass_of($className, IOptionType::class)) { - throw new SystemException("'".$className."' does not implement '".IOptionType::class."'"); + throw new ImplementationException($className, IOptionType::class); } return $className; diff --git a/wcfsetup/install/files/lib/system/option/user/group/UserGroupOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/group/UserGroupOptionHandler.class.php index 5625f60f7a..5ef44f6e79 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/UserGroupOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/UserGroupOptionHandler.class.php @@ -3,7 +3,7 @@ namespace wcf\system\option\user\group; use wcf\data\option\Option; use wcf\data\user\group\UserGroup; use wcf\system\cache\builder\UserGroupOptionCacheBuilder; -use wcf\system\exception\SystemException; +use wcf\system\exception\ImplementationException; use wcf\system\exception\UserInputException; use wcf\system\option\OptionHandler; use wcf\system\WCF; @@ -85,7 +85,7 @@ class UserGroupOptionHandler extends OptionHandler { return null; } if (!is_subclass_of($className, IUserGroupOptionType::class)) { - throw new SystemException("'".$className."' does not implement '".IUserGroupOptionType::class."'"); + throw new ImplementationException($className, IUserGroupOptionType::class); } return $className; diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index b875a77500..0fc1c923c4 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -16,6 +16,7 @@ use wcf\system\cache\CacheHandler; use wcf\system\database\statement\PreparedStatement; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\event\EventHandler; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\form\container\GroupFormElementContainer; use wcf\system\form\container\MultipleSelectionFormElementContainer; @@ -570,7 +571,7 @@ class PackageInstallationDispatcher { $plugin = new $className($this, $nodeData); if (!($plugin instanceof IPackageInstallationPlugin)) { - throw new SystemException("'".$className."' does not implement '".IPackageInstallationPlugin::class."'"); + throw new ImplementationException($className, IPackageInstallationPlugin::class); } // execute PIP diff --git a/wcfsetup/install/files/lib/system/poll/PollManager.class.php b/wcfsetup/install/files/lib/system/poll/PollManager.class.php index 8f2baaeb98..3117fd55df 100644 --- a/wcfsetup/install/files/lib/system/poll/PollManager.class.php +++ b/wcfsetup/install/files/lib/system/poll/PollManager.class.php @@ -7,6 +7,8 @@ use wcf\data\poll\Poll; use wcf\data\poll\PollAction; use wcf\data\poll\PollList; use wcf\system\database\util\PreparedStatementConditionBuilder; +use wcf\system\exception\ImplementationException; +use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; use wcf\system\SingletonFactory; @@ -422,10 +424,10 @@ class PollManager extends SingletonFactory { // validates against object type's class $className = $this->cache[$objectType]->className; if (!is_subclass_of($className, IPollHandler::class)) { - throw new SystemException("'".$className."' does not implement '".IPollHandler::class."'"); + throw new ImplementationException($className, IPollHandler::class); } else if (!is_subclass_of($className, SingletonFactory::class)) { - throw new SystemException("'".$className."' does not extend '".SingletonFactory::class."'"); + throw new ParentClassException($className, SingletonFactory::class); } $object = call_user_func([$className, 'getInstance']); diff --git a/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php b/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php index 51f97868e1..de563ae44b 100644 --- a/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php @@ -3,6 +3,7 @@ namespace wcf\system\search\acp; use wcf\data\acp\search\provider\ACPSearchProvider; use wcf\system\application\ApplicationHandler; use wcf\system\cache\builder\ACPSearchProviderCacheBuilder; +use wcf\system\exception\ImplementationException; use wcf\system\exception\SystemException; use wcf\system\SingletonFactory; @@ -52,7 +53,7 @@ class ACPSearchHandler extends SingletonFactory { foreach ($this->cache as $acpSearchProvider) { $className = $acpSearchProvider->className; if (!is_subclass_of($className, IACPSearchResultProvider::class)) { - throw new SystemException("'".$className."' does not implement '".IACPSearchResultProvider::class."'"); + throw new ImplementationException($className, IACPSearchResultProvider::class); } $provider = new $className(); diff --git a/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php b/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php index 735b5e9187..1bb1f79468 100644 --- a/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php +++ b/wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php @@ -3,6 +3,8 @@ namespace wcf\system\upload; use wcf\data\AbstractDatabaseObjectAction; use wcf\data\IFile; use wcf\data\IThumbnailFile; +use wcf\system\exception\ImplementationException; +use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; use wcf\system\image\ImageHandler; use wcf\system\WCF; @@ -69,13 +71,13 @@ class DefaultUploadFileSaveStrategy implements IUploadFileSaveStrategy { $this->data = $data; if (!is_subclass_of($this->actionClassName, AbstractDatabaseObjectAction::class)) { - throw new SystemException("'".$this->actionClassName."' does not extend '".AbstractDatabaseObjectAction::class."'"); + throw new ParentClassException($this->actionClassName, AbstractDatabaseObjectAction::class); } $this->editorClassName = (new $this->actionClassName([], ''))->getClassName(); $baseClass = call_user_func([$this->editorClassName, 'getBaseClass']); if (!is_subclass_of($baseClass, IFile::class)) { - throw new SystemException("'".$this->editorClassName."' does not implement '".IFile::class."'"); + throw new ImplementationException($baseClass, IFile::class); } if (is_subclass_of($baseClass, IThumbnailFile::class)) { $this->options['thumbnailSizes'] = call_user_func([$baseClass, 'getThumbnailSizes']); diff --git a/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php b/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php index ebbdd448d6..18b673b88c 100644 --- a/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php +++ b/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php @@ -1,7 +1,7 @@ fireAction($this, 'init'); if (!is_subclass_of($this->className, IUserAuthentication::class)) { - throw new SystemException("'" . $this->className . "' does not implement '".IUserAuthentication::class."'"); + throw new ImplementationException($this->className, IUserAuthentication::class); } $this->userAuthentication = call_user_func([$this->className, 'getInstance']); diff --git a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php index 23b38ed30d..d2c6502305 100644 --- a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php @@ -2,6 +2,7 @@ namespace wcf\system\worker; use wcf\data\DatabaseObjectList; use wcf\system\event\EventHandler; +use wcf\system\exception\ParentClassException; use wcf\system\exception\SystemException; use wcf\system\request\LinkHandler; use wcf\system\search\SearchIndexManager; @@ -93,7 +94,7 @@ abstract class AbstractRebuildDataWorker extends AbstractWorker implements IRebu } if (!is_subclass_of($this->objectListClassName, DatabaseObjectList::class)) { - throw new SystemException("'".$this->objectListClassName."' does not extend '".DatabaseObjectList::class."'"); + throw new ParentClassException($this->objectListClassName, DatabaseObjectList::class); } $this->objectList = new $this->objectListClassName(); diff --git a/wcfsetup/install/files/lib/util/DOMUtil.class.php b/wcfsetup/install/files/lib/util/DOMUtil.class.php index dddaee7f25..b2c7b01fb1 100644 --- a/wcfsetup/install/files/lib/util/DOMUtil.class.php +++ b/wcfsetup/install/files/lib/util/DOMUtil.class.php @@ -1,6 +1,5 @@