Add ImplementationException and ParentClassException
authorMatthias Schmidt <gravatronics@live.com>
Sat, 21 May 2016 12:13:24 +0000 (14:13 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 21 May 2016 12:19:38 +0000 (14:19 +0200)
30 files changed:
wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php
wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php
wcfsetup/install/files/lib/action/AJAXProxyAction.class.php
wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php
wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php
wcfsetup/install/files/lib/data/object/type/ObjectType.class.php
wcfsetup/install/files/lib/data/sitemap/Sitemap.class.php
wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php
wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php
wcfsetup/install/files/lib/page/MultipleLinkPage.class.php
wcfsetup/install/files/lib/page/SearchResultPage.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php
wcfsetup/install/files/lib/system/cache/builder/UserGroupPermissionCacheBuilder.class.php
wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php
wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php
wcfsetup/install/files/lib/system/event/EventHandler.class.php
wcfsetup/install/files/lib/system/exception/ImplementationException.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/exception/ParentClassException.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacode.class.php
wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php
wcfsetup/install/files/lib/system/option/OptionHandler.class.php
wcfsetup/install/files/lib/system/option/user/group/UserGroupOptionHandler.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/poll/PollManager.class.php
wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php
wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php
wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php
wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php
wcfsetup/install/files/lib/util/DOMUtil.class.php

index 8c4f6cabc6d7c8913f2c92ce3a73fe6c0529668b..a7dec70ee5d0f9b9abe520ad5db8f7dbce3c8ff8 100644 (file)
@@ -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);
                }
        }
        
index fcb7fe597c9c84091971a9ff8a1d21e9bc6b2896..3dd726c4796593dea262b1c986170554f9c9e718 100644 (file)
@@ -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
index d8c8e5bf98ad64468fa2f4912d17f82599e28dca..d6e18976f08603ac1741b7e236e2b24c569b8904 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\action;
 use wcf\data\IDatabaseObjectAction;
-use wcf\system\exception\SystemException;
+use wcf\system\exception\ImplementationException;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 use wcf\util\StringUtil;
@@ -57,12 +57,12 @@ class AJAXProxyAction extends AJAXInvokeAction {
         */
        protected function invoke() {
                if (!is_subclass_of($this->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);
                        }
                }
                
index 9bc0d4f995d5485ce3c516d9cbe1d77de309282d..5e5dfa2b6d1a434bd1dee90819da28aa111959f0 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data;
+use wcf\system\exception\ImplementationException;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 
@@ -39,7 +40,7 @@ class ProcessibleDatabaseObject extends DatabaseObject {
                                        throw new SystemException("Unable to find class '".$this->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);
index 8578899ad8e48ff6ebba68bc4ad61b6c23d8602b..39d27d5f8e1b042321f0d93ead13845782eb5928 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\data;
 use wcf\data\category\AbstractDecoratedCategory;
+use wcf\system\exception\ParentClassException;
 use wcf\system\exception\SystemException;
 use wcf\system\WCF;
 
@@ -62,7 +63,7 @@ trait TMultiCategoryObject {
                        
                        $className = static::getCategoryClassName();
                        if (!is_subclass_of($className, AbstractDecoratedCategory::class)) {
-                               throw new SystemException("'".$className."' does not extend '".AbstractDecoratedCategory::class."'.");
+                               throw new ParentClassException($className, AbstractDecoratedCategory::class);
                        }
                        
                        if (!empty($this->categoryIDs)) {
index 1f0af441d0b46c0245b3771305814a79dcdc14fa..0bc7949fba23d00d240aade66f95fab263da8f69 100644 (file)
@@ -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)) {
index 7868b2c1a5beacbdeb25a1ae530be1caa14c651a..017f84353f3dab5351d1a660d63e716495017ab5 100644 (file)
@@ -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();
index 8add39cfdcae3c52407837ad7c00192093525175..80dfed9587f2cca3cd64bac9584212016cec8469 100644 (file)
@@ -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();
index aba58b66aebd3be3d82f290144058da7d128d60b..1da8b1199259f85a35a4347b5ce4c472308a464b 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 namespace wcf\data\user\profile\menu\item;
+use wcf\system\exception\ImplementationException;
+use wcf\system\exception\ParentClassException;
 use wcf\system\menu\user\profile\content\IUserProfileMenuContent;
 use wcf\data\DatabaseObject;
 use wcf\data\TDatabaseObjectOptions;
@@ -67,11 +69,11 @@ class UserProfileMenuItem extends DatabaseObject {
                        }
                        
                        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);
                        }
                        
                        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']);
index 277ce1c45e185fb6d3e04a131a66b668e98da611..889d529a20c20b20917359cf87fb955acdd8bba7 100644 (file)
@@ -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();
index 7c95ef4548eeef00c545981733d1806d611c8d9a..0a0680d01b00bd0e8536345190be2ee7eb883872 100644 (file)
@@ -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;
index 2fc6c4dcebf8e1bc0e6e006798f1f24e9f7652fe..80611c82b98fa14514662f5f5e71996a6e66f7cf 100644 (file)
@@ -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']);
index 2f417ceb5c404c6e07f280da1e522b945e53341e..10a53106070a83d41ee20c16d871db76db032f5d 100644 (file)
@@ -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);
                        }
                }
                
index 313d972b63054cb177f1619d326a45a0138f0b51..55c00510e58113c72b2fd9352eb71a1c8e2488a2 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\cache\builder;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\ImplementationException;
 use wcf\system\exception\SystemException;
 use wcf\system\option\user\group\IUserGroupOptionType;
 use wcf\system\WCF;
@@ -98,7 +99,7 @@ class UserGroupPermissionCacheBuilder extends AbstractCacheBuilder {
                                throw new SystemException("unable to find class '".$className."'");
                        }
                        if (!is_subclass_of($className, IUserGroupOptionType::class)) {
-                               throw new SystemException("'".$className."' does not implement '".IUserGroupOptionType::class."'");
+                               throw new ImplementationException($className, IUserGroupOptionType::class);
                        }
                        
                        // create instance
index c37b9b4fb4a691861f2027b31118239541ddd3a1..4358ed696a48c59159788e8ce3fe115b17ce551e 100644 (file)
@@ -6,6 +6,7 @@ use wcf\system\cache\builder\ClipboardActionCacheBuilder;
 use wcf\system\cache\builder\ClipboardPageCacheBuilder;
 use wcf\system\clipboard\action\IClipboardAction;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\ImplementationException;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
@@ -325,7 +326,7 @@ class ClipboardHandler extends SingletonFactory {
                        if (!isset($actions[$actionClassName])) {
                                // validate class
                                if (!is_subclass_of($actionClassName, IClipboardAction::class)) {
-                                       throw new SystemException("'".$actionClassName."' does not implement '".IClipboardAction::class."'");
+                                       throw new ImplementationException($actionClassName, IClipboardAction::class);
                                }
                                
                                $actions[$actionClassName] = [
index 950c1834dfc5428f62fbc4f516521d4c79aaded2..085c588493f1c4b0fb4ea7619bab96dc2988d9ab 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\cronjob\log\CronjobLogEditor;
 use wcf\data\cronjob\Cronjob;
 use wcf\data\cronjob\CronjobEditor;
 use wcf\system\cache\builder\CronjobCacheBuilder;
+use wcf\system\exception\ImplementationException;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
@@ -174,7 +175,7 @@ class CronjobScheduler extends SingletonFactory {
                
                // verify class signature
                if (!(is_subclass_of($className, ICronjob::class))) {
-                       throw new SystemException("'".$className."' does not implement '".ICronjob::class."'");
+                       throw new ImplementationException($className, ICronjob::class);
                }
                
                // execute cronjob
index a3db6b589301b849c29aafe50752f8f0ddfb1d53..837eccdd370fa5446940b3394a42efe311a1fd90 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\event\listener\EventListener;
 use wcf\system\cache\builder\EventListenerCacheBuilder;
 use wcf\system\event\listener\IParameterizedEventListener;
 use wcf\system\event\IEventListener as ILegacyEventListener;
+use wcf\system\exception\ImplementationException;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 
@@ -116,7 +117,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);
                                                                                }
                                                                        }
                                                                        
@@ -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 (file)
index 0000000..5eb8b6a
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\system\exception;
+
+/**
+ * Exception implementation for cases when a class is expected to implement a certain
+ * interface but that is not the case.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..8abcf32
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\system\exception;
+
+/**
+ * Exception implementation for cases when a class is expected to have a certain class
+ * as a parent class but that is not the case.
+ *
+ * @author     Matthias Schmidt
+ * @copyright  2001-2016 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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}'.");
+       }
+}
index eaf8401fc9dc9864963c041df0cc0d0c9e609a4f..a3c28b26b2dfae5d79718c7d824dab1bebb58b36 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 namespace wcf\system\html\input\node;
-use wcf\system\bbcode\HtmlBBCodeParser;
-use wcf\system\exception\SystemException;
 use wcf\system\html\metacode\converter\IMetacodeConverter;
 use wcf\system\html\metacode\converter\SimpleMetacodeConverter;
 use wcf\system\html\node\AbstractHtmlNode;
index 4977567595d1e1c1eed89725cb44b8f9085f1ddd..972be6253ba39d0d7a7f2ac264a6ee09600ddab1 100644 (file)
@@ -7,6 +7,7 @@ use wcf\data\IMessageQuickReplyAction;
 use wcf\data\IVisitableObjectAction;
 use wcf\system\bbcode\PreParser;
 use wcf\system\event\EventHandler;
+use wcf\system\exception\ParentClassException;
 use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
 use wcf\system\SingletonFactory;
@@ -137,7 +138,7 @@ class QuickReplyManager extends SingletonFactory {
                $this->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);
index 16a98ffb318bd1a4356d98c45086adc1c3cad077..8a474b2808fe0ffcdef027bf871054ad00857b63 100644 (file)
@@ -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;
index 5625f60f7a5ac840a2fb9cfeff99357655c67be5..5ef44f6e79fdd5c0d8112cb5b211faf9b67ad623 100644 (file)
@@ -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;
index b875a77500c4b9e069a97dcf7e21b8fbc81b1f1a..0fc1c923c4e76fc1fa52d00fd4c2943a8e1b3de6 100644 (file)
@@ -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
index 8f2baaeb9854173c7251b86d5b041e72988f8379..3117fd55df085bc2ec8e6acfe0c191e30520f168 100644 (file)
@@ -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']);
index 51f97868e161728672966e9b4e5f3fd18502b954..de563ae44b363b2eaf7096f4bf93632b41b3723a 100644 (file)
@@ -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();
index 735b5e9187c4f4123e794d1774bce20683556fe9..1bb1f79468de22bab066087d8fe3a33d71cf0926 100644 (file)
@@ -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']);
index ebbdd448d6b841ae6a71180636ae1ecf2397f27a..18b673b88c903bebe45ad236b7c670a8a32da2d3 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\system\user\authentication;
 use wcf\system\event\EventHandler;
-use wcf\system\exception\SystemException;
+use wcf\system\exception\ImplementationException;
 use wcf\system\SingletonFactory;
 
 /**
@@ -35,7 +35,7 @@ class UserAuthenticationFactory extends SingletonFactory {
                EventHandler::getInstance()->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']);
index 23b38ed30d06998358bcc8fe26ebb1da411337ef..d2c6502305fcc8a5df9c0ba475a8a7b671742b0d 100644 (file)
@@ -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();
index dddaee7f25610ab11cd4848dc501e61a280637de..b2c7b01fb1a8333375ec6d48ee84becf977f220b 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace wcf\util;
-use wcf\system\exception\SystemException;
 
 /**
  * Provides helper methods to work with PHP's DOM implementation.