Add and use InvalidObjectArgument (#3672)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 2 Nov 2020 12:14:21 +0000 (13:14 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 12:14:21 +0000 (13:14 +0100)
Close #3664

21 files changed:
wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php
wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php
wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php
wcfsetup/install/files/lib/system/condition/UserCoverPhotoCondition.class.php
wcfsetup/install/files/lib/system/condition/UserEmailCondition.class.php
wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php
wcfsetup/install/files/lib/system/condition/UserLanguageCondition.class.php
wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php
wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php
wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php
wcfsetup/install/files/lib/system/condition/UserSignatureCondition.class.php
wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php
wcfsetup/install/files/lib/system/condition/UserTrophyCondition.class.php
wcfsetup/install/files/lib/system/condition/UserUserIDCondition.class.php
wcfsetup/install/files/lib/system/condition/UserUsernameCondition.class.php
wcfsetup/install/files/lib/system/condition/article/ArticleCategoryCondition.class.php
wcfsetup/install/files/lib/system/condition/user/UserLastActivityTimeIntervalDaysCondition.class.php
wcfsetup/install/files/lib/system/condition/user/activity/event/UserActivityEventExcludedObjectTypeCondition.class.php
wcfsetup/install/files/lib/system/condition/user/trophy/UserTrophyExcludedTrophiesCondition.class.php
wcfsetup/install/files/lib/system/condition/user/trophy/UserTrophyExcludedTrophyCategoriesCondition.class.php
wcfsetup/install/files/lib/system/exception/InvalidObjectArgument.class.php [new file with mode: 0644]

index 5991536f46b4e5cfe49724d8b886a4ed90a54ad8..9df56bd01d04a297284a36a016c634894c852179 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\system\condition;
 use wcf\data\condition\Condition;
 use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 
 /**
  * Abstract condition implementation for check a text-typed property of a database
@@ -40,7 +41,7 @@ abstract class AbstractObjectTextPropertyCondition extends AbstractTextCondition
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                $className = $this->getListClassName();
                if (!($objectList instanceof $className)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '{$className}', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, $className, 'Object list');
                }
                
                if ($this->supportsMultipleValues) {
@@ -57,7 +58,7 @@ abstract class AbstractObjectTextPropertyCondition extends AbstractTextCondition
        public function checkObject(DatabaseObject $object, array $conditionData) {
                $className = $this->getClassName();
                if (!($object instanceof $className)) {
-                       throw new \InvalidArgumentException("Object is no instance of '{$className}', instance of '".get_class($object)."' given.");
+                       throw new InvalidObjectArgument($object, $className);
                }
                
                return in_array($object->{$this->getPropertyName()}, $conditionData[$this->fieldName]);
index dc80ba5b58a7809f1e60e7fdf01f48db93ec5c68..500554a1cf7e98202e09267ccadaf3a0928e985b 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\system\condition;
 use wcf\data\condition\Condition;
 use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 
@@ -47,7 +48,7 @@ abstract class AbstractTimestampCondition extends AbstractSingleFieldCondition i
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                $className = $this->getListClassName();
                if (!($objectList instanceof $className)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '{$className}', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, $className, 'Object list');
                }
                
                /** @noinspection PhpUndefinedFieldInspection */
@@ -68,7 +69,7 @@ abstract class AbstractTimestampCondition extends AbstractSingleFieldCondition i
        public function checkObject(DatabaseObject $object, array $conditionData) {
                $className = $this->getClassName();
                if (!($object instanceof $className)) {
-                       throw new \InvalidArgumentException("Object is no instance of '{$className}', instance of '".get_class($object)."' given.");
+                       throw new InvalidObjectArgument($object, $className);
                }
                
                if (isset($conditionData['startTime']) && $object->{$this->getPropertyName()} < strtotime($conditionData['startTime'])) {
index 0abeaa4685b2c0cb412ef8cc35c67f64a53081ec..6fe7af969db50a392b3fbf519e223a420088bed4 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -50,7 +51,7 @@ class UserAvatarCondition extends AbstractSelectCondition implements IContentCon
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                switch ($conditionData['userAvatar']) {
index 02eb0b0efec8eb96b30d6426bd575c264d17d666..d72861b79288f5b20571f4230e55ab2a78a8567b 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -45,7 +46,7 @@ class UserCoverPhotoCondition extends AbstractSelectCondition implements IConten
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                switch ($conditionData['userCoverPhoto']) {
index 69bebfd185e48da46528ebe0736722b3ce1e183b..528219b81bdf178a51dc0a70b87ad3a63ede1e8f 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -32,7 +33,7 @@ class UserEmailCondition extends AbstractTextCondition implements IContentCondit
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_table.email LIKE ?', ['%'.addcslashes($conditionData['email'], '_%').'%']);
index 5a42dea876d7a727cb304bbbab5c3d01e73286ab..680d30d7418b5cfcb29c559656b462715ae6e384 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -22,7 +23,7 @@ class UserIntegerPropertyCondition extends AbstractIntegerCondition implements I
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                if (isset($conditionData['greaterThan'])) {
index b5b2f6692517c22017d9eeddb0b5df9234ee9ba2..e9abf20892e0a951c48ae551dac0d2c7666fa58e 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\LanguageFactory;
 use wcf\system\WCF;
@@ -36,7 +37,7 @@ class UserLanguageCondition extends AbstractSingleFieldCondition implements ICon
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_table.languageID IN (?)', [$conditionData['languageIDs']]);
index cb40e75fb02d2650c21041d36fac4567050442e9..0aadd74a00fd8113c3bb428af75e051628bf337d 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\option\user\UserOptionHandler;
 use wcf\system\WCF;
 
@@ -41,7 +42,7 @@ class UserOptionsCondition extends AbstractMultipleFieldsCondition implements IC
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                $optionValues = $conditionData['optionValues'];
index 163a6c81192ece6a0b70c3f139375c53dd202bfb..1ed1420258c94a72c6c3f12ad8fa1744df3dadd7 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 
@@ -40,7 +41,7 @@ class UserRegistrationDateCondition extends AbstractSingleFieldCondition impleme
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                if (isset($conditionData['registrationDateEnd'])) {
index 97dcc00a6cda2341c27156ca9b5d6123644b06bc..66254ec1e30023d7845071293d577731b8faf563 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 
@@ -34,7 +35,7 @@ class UserRegistrationDateIntervalCondition extends AbstractIntegerCondition imp
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                if (isset($conditionData['greaterThan'])) {
index e2baa4820cf6ae9eed8a03c1519c3df6b612b8d7..857a66c65a38ce781f9e56745a07ec39c869d57f 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -45,7 +46,7 @@ class UserSignatureCondition extends AbstractSelectCondition implements IContent
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                switch ($conditionData['userSignature']) {
index 327044dba1e7c7657db8d1290bacbdba81d7442c..d8fe860d4bc8b8d97edc69eb56b2d920fe99a26a 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 
@@ -65,7 +66,7 @@ class UserStateCondition extends AbstractSingleFieldCondition implements IConten
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                if (isset($conditionData['userIsBanned'])) {
index 9dbd4ea58b75cb7dc66c150312a464d3321dabc5..f7dfe6f7a1039cb48ba63e1c0b161cd7eafaf8de 100644 (file)
@@ -7,6 +7,7 @@ use wcf\data\user\trophy\UserTrophyList;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
@@ -62,7 +63,7 @@ class UserTrophyCondition extends AbstractMultipleFieldsCondition implements ICo
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                if (isset($conditionData['userTrophyIDs'])) {
index ba0e355ff616742632df007e63cb091060c368f1..4b5236a2d7dd0cf7a5c68a18c023a6c4a28a97d0 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -32,7 +33,7 @@ class UserUserIDCondition extends AbstractSingleFieldCondition implements IConte
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is not an instance of '".UserList::class."', an instance of '".get_class($objectList)."' was given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_table.userID = ?', [$conditionData['userID']]);
index 3bc51dc3814dc4756c5474897eff2f41471ce299..baff6a6144c0b3382a880e36dd32ee7b496e1b20 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\condition\Condition;
 use wcf\data\user\User;
 use wcf\data\user\UserList;
 use wcf\data\DatabaseObjectList;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -32,7 +33,7 @@ class UserUsernameCondition extends AbstractTextCondition implements IContentCon
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_table.username LIKE ?', ['%'.addcslashes($conditionData['username'], '_%').'%']);
index 75152476e6cc16f439d832c513e0bef9cd8bb1af..abbc0edb88fabe595b5189605bf1f69dfe2438f8 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\article\ArticleList;
 use wcf\data\DatabaseObjectList;
 use wcf\system\condition\AbstractMultiCategoryCondition;
 use wcf\system\condition\IObjectListCondition;
+use wcf\system\exception\InvalidObjectArgument;
 
 /**
  * Condition implementation for the category an article belongs to.
@@ -35,7 +36,7 @@ class ArticleCategoryCondition extends AbstractMultiCategoryCondition implements
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof ArticleList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".ArticleList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, ArticleList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('article.categoryID IN (?)', [$conditionData[$this->fieldName]]);
index 18665dd4ada7ce0c9b8379511be49c6d37099c5b..ff962f6c973985d30a8d0c154b21201bea10b645 100644 (file)
@@ -8,6 +8,7 @@ use wcf\data\user\UserList;
 use wcf\system\condition\AbstractSingleFieldCondition;
 use wcf\system\condition\IObjectCondition;
 use wcf\system\condition\IObjectListCondition;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
 use wcf\util\ClassUtil;
@@ -44,7 +45,7 @@ class UserLastActivityTimeIntervalDaysCondition extends AbstractSingleFieldCondi
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '" . UserList::class . "', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserList::class, 'Object list');
                }
                
                /** @noinspection PhpUndefinedFieldInspection */
@@ -64,7 +65,7 @@ class UserLastActivityTimeIntervalDaysCondition extends AbstractSingleFieldCondi
         */
        public function checkObject(DatabaseObject $object, array $conditionData) {
                if (!($object instanceof User) && !ClassUtil::isDecoratedInstanceOf($object, User::class)) {
-                       throw new \InvalidArgumentException("Object is no instance of '" . User::class . "', instance of '".get_class($object)."' given.");
+                       throw new InvalidObjectArgument($objectList, User::class);
                }
                
                if (isset($conditionData['startDays'])) {
index 995be9b1d913cc1b425fc088e4b5ca4a7d65ee7f..497ee1f892b603d29db8568d62b061ae2897c465 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\user\activity\event\UserActivityEventList;
 use wcf\data\DatabaseObjectList;
 use wcf\system\condition\AbstractMultiSelectCondition;
 use wcf\system\condition\IObjectListCondition;
+use wcf\system\exception\InvalidObjectArgument;
 use wcf\system\WCF;
 
 /**
@@ -37,7 +38,7 @@ class UserActivityEventExcludedObjectTypeCondition extends AbstractMultiSelectCo
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserActivityEventList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserActivityEventList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserActivityEventList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_activity_event.objectTypeID NOT IN (?)', [$conditionData[$this->fieldName]]);
index 3127d2899c5782a5b452fcd0441ad140874d6959..f95fa83b19b0df97cd22f2c4032e048fa92e3445 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\user\trophy\UserTrophyList;
 use wcf\data\DatabaseObjectList;
 use wcf\system\condition\AbstractMultiSelectCondition;
 use wcf\system\condition\IObjectListCondition;
+use wcf\system\exception\InvalidObjectArgument;
 
 /**
  * Condition implementation for the excluded trophies.
@@ -36,7 +37,7 @@ class UserTrophyExcludedTrophiesCondition extends AbstractMultiSelectCondition i
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserTrophyList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserTrophyList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserTrophyList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('user_trophy.trophyID NOT IN (?)', [$conditionData[$this->fieldName]]);
index 0d181b166dccef10723c956a721bfc1d6c17f493..b37682e848723cb73f8985101f4397dea88e8787 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\user\trophy\UserTrophyList;
 use wcf\data\DatabaseObjectList;
 use wcf\system\condition\AbstractMultiSelectCondition;
 use wcf\system\condition\IObjectListCondition;
+use wcf\system\exception\InvalidObjectArgument;
 
 /**
  * Condition implementation for the excluded trophies.
@@ -36,7 +37,7 @@ class UserTrophyExcludedTrophyCategoriesCondition extends AbstractMultiSelectCon
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
                if (!($objectList instanceof UserTrophyList)) {
-                       throw new \InvalidArgumentException("Object list is no instance of '".UserTrophyList::class."', instance of '".get_class($objectList)."' given.");
+                       throw new InvalidObjectArgument($objectList, UserTrophyList::class, 'Object list');
                }
                
                $objectList->getConditionBuilder()->add('trophy.categoryID NOT IN (?)', [$conditionData[$this->fieldName]]);
diff --git a/wcfsetup/install/files/lib/system/exception/InvalidObjectArgument.class.php b/wcfsetup/install/files/lib/system/exception/InvalidObjectArgument.class.php
new file mode 100644 (file)
index 0000000..600746c
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\system\exception;
+
+/**
+ * Exception implementation instances where an API allows passing generic objects but a concrete
+ * implementation requires the objects to be instances of a specific (sub)class.
+ * 
+ * @author      Matthias Schmidt
+ * @copyright   2001-2020 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package     WoltLabSuite\Core\System\Exception
+ * @since       5.4
+ */
+class InvalidObjectArgument extends \InvalidArgumentException {
+       /**
+        * InvalidObjectArgument constructor.
+        */
+       public function __construct(object $object, string $expectedClass, string $objectName = 'Object') {
+               parent::__construct("{$objectName} is no instance of '{$expectedClass}', instance of '" . get_class($object) . "' given.");
+       }
+}