From: Matthias Schmidt Date: Tue, 10 May 2016 20:24:47 +0000 (+0200) Subject: Throw PHP's \InvalidArgumentException X-Git-Tag: 3.0.0_Beta_1~1742 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a92f7b9682be49e7310d314af2966b4de1a458b7;p=GitHub%2FWoltLab%2FWCF.git Throw PHP's \InvalidArgumentException --- diff --git a/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php index f0c165b01e..0a0ceb2906 100644 --- a/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php @@ -2,7 +2,6 @@ namespace wcf\system\condition; use wcf\data\DatabaseObject; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; /** * Abstract condition implementation for check a text-typed property of a database @@ -42,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 \InvalidArgumentException("Object list is no instance of '{$className}', instance of '".get_class($objectList)."' given."); } if ($this->supportsMultipleValues) { diff --git a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php index 4fe0c4895f..8501e32562 100644 --- a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php @@ -3,7 +3,6 @@ namespace wcf\system\condition; use wcf\data\condition\Condition; use wcf\data\DatabaseObject; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\exception\UserInputException; use wcf\system\WCF; @@ -50,7 +49,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 \InvalidArgumentException("Object list is no instance of '{$className}', instance of '".get_class($objectList)."' given."); } $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' <> ?', [0]); diff --git a/wcfsetup/install/files/lib/system/condition/IObjectListCondition.class.php b/wcfsetup/install/files/lib/system/condition/IObjectListCondition.class.php index cd3029b9e9..13323346e4 100644 --- a/wcfsetup/install/files/lib/system/condition/IObjectListCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/IObjectListCondition.class.php @@ -21,6 +21,7 @@ interface IObjectListCondition extends ICondition { * * @param DatabaseObjectList $objectList * @param array $conditionData + * @throws \InvalidArgumentException if the given object list object is no object of the expected database object list class */ public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData); } diff --git a/wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php index 023095dc18..c6ef357d84 100644 --- a/wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserAvatarCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\WCF; /** @@ -53,7 +52,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } switch ($conditionData['userAvatar']) { diff --git a/wcfsetup/install/files/lib/system/condition/UserEmailCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserEmailCondition.class.php index 5f2307b17f..e46f563dcf 100644 --- a/wcfsetup/install/files/lib/system/condition/UserEmailCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserEmailCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\WCF; /** @@ -35,7 +34,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } $objectList->getConditionBuilder()->add('user_table.email LIKE ?', ['%'.addcslashes($conditionData['email'], '_%').'%']); diff --git a/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php index 9913a65f14..b8ffbe4e5d 100644 --- a/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php @@ -5,7 +5,6 @@ use wcf\data\user\group\UserGroup; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\util\ArrayUtil; @@ -63,7 +62,7 @@ class UserGroupCondition extends AbstractMultipleFieldsCondition 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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } if (isset($conditionData['groupIDs'])) { diff --git a/wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php index 005dfb43f7..6d985fddbc 100644 --- a/wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserIntegerPropertyCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\WCF; /** @@ -25,7 +24,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } if (isset($conditionData['greaterThan'])) { diff --git a/wcfsetup/install/files/lib/system/condition/UserLanguageCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserLanguageCondition.class.php index 111685df26..cb7083a45e 100644 --- a/wcfsetup/install/files/lib/system/condition/UserLanguageCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserLanguageCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\exception\UserInputException; use wcf\system\language\LanguageFactory; use wcf\system\WCF; @@ -39,7 +38,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } $objectList->getConditionBuilder()->add('user_table.languageID IN (?)', [$conditionData['languageIDs']]); diff --git a/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php index 2584444bc4..baee7c8134 100644 --- a/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserOptionsCondition.class.php @@ -5,7 +5,6 @@ use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObject; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\option\user\UserOptionHandler; use wcf\system\WCF; @@ -44,7 +43,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } $optionValues = $conditionData['optionValues']; diff --git a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php index 13bbccb14b..a930235e9c 100644 --- a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\exception\UserInputException; use wcf\system\WCF; @@ -43,7 +42,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } if (isset($conditionData['registrationDateEnd'])) { diff --git a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php index 99d6a17bef..4fb83286bf 100644 --- a/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserRegistrationDateIntervalCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\WCF; /** @@ -36,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } if ($conditionData['greaterThan'] !== null) { diff --git a/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php index fa59fd5222..6276adc65a 100644 --- a/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserStateCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\exception\UserInputException; use wcf\system\WCF; @@ -55,7 +54,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } if (isset($conditionData['userIsBanned'])) { diff --git a/wcfsetup/install/files/lib/system/condition/UserUsernameCondition.class.php b/wcfsetup/install/files/lib/system/condition/UserUsernameCondition.class.php index d17db653c0..4a05be502d 100644 --- a/wcfsetup/install/files/lib/system/condition/UserUsernameCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/UserUsernameCondition.class.php @@ -4,7 +4,6 @@ use wcf\data\condition\Condition; use wcf\data\user\User; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; -use wcf\system\exception\InvalidArgumentException; use wcf\system\WCF; /** @@ -35,7 +34,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 \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given."); } $objectList->getConditionBuilder()->add('user_table.username LIKE ?', ['%'.addcslashes($conditionData['username'], '_%').'%']);