From: Matthias Schmidt Date: Tue, 11 May 2021 17:14:40 +0000 (+0200) Subject: Use `InvalidObjectArgument` in more places (#4207) X-Git-Tag: 5.4.0_Alpha_3~50 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8fda7b010c399c705180baacf393b5fa339e70ac;p=GitHub%2FWoltLab%2FWCF.git Use `InvalidObjectArgument` in more places (#4207) --- diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php index e9b14cc96a..cf08f4f9f9 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php @@ -7,6 +7,7 @@ use wcf\data\DatabaseObjectList; use wcf\data\user\group\UserGroup; use wcf\data\user\UserEditor; use wcf\data\user\UserList; +use wcf\system\exception\InvalidObjectArgument; use wcf\system\exception\UserInputException; use wcf\system\user\storage\UserStorageHandler; use wcf\system\WCF; @@ -61,7 +62,7 @@ abstract class AbstractUserGroupsUserBulkProcessingAction extends AbstractUserBu public function executeAction(DatabaseObjectList $objectList) { 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'); } $users = $this->getAccessibleUsers($objectList); diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php index 14b3aa0491..1d84e0f0c4 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php @@ -5,6 +5,7 @@ namespace wcf\system\bulk\processing\user; use wcf\data\DatabaseObjectList; use wcf\data\user\UserAction; use wcf\data\user\UserList; +use wcf\system\exception\InvalidObjectArgument; use wcf\system\WCF; /** @@ -24,7 +25,7 @@ class DeleteUserBulkProcessingAction extends AbstractUserBulkProcessingAction public function executeAction(DatabaseObjectList $objectList) { 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'); } $users = $this->getAccessibleUsers($objectList); diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/ExportMailAddressUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/ExportMailAddressUserBulkProcessingAction.class.php index 5332c561c9..f7484cbff7 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/ExportMailAddressUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/ExportMailAddressUserBulkProcessingAction.class.php @@ -4,6 +4,7 @@ namespace wcf\system\bulk\processing\user; use wcf\data\DatabaseObjectList; use wcf\data\user\UserList; +use wcf\system\exception\InvalidObjectArgument; use wcf\system\WCF; use wcf\util\StringUtil; @@ -48,7 +49,7 @@ class ExportMailAddressUserBulkProcessingAction extends AbstractUserBulkProcessi public function executeAction(DatabaseObjectList $objectList) { 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'); } $this->executed = true; diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php index 98cea41c00..6d8197e1fd 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php @@ -5,6 +5,7 @@ namespace wcf\system\bulk\processing\user; use wcf\data\DatabaseObjectList; use wcf\data\user\UserList; use wcf\system\email\EmailGrammar; +use wcf\system\exception\InvalidObjectArgument; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\util\StringUtil; @@ -62,7 +63,7 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction public function executeAction(DatabaseObjectList $objectList) { 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 (\count($objectList)) {