From 05a37a7abf8930ff15bffab85b95c815fe73a6dc Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 15 Sep 2022 17:41:00 -0400 Subject: [PATCH] Replace CRM_Core_Exception aliases - ext,bin dir --- bin/ContributionProcessor.php | 2 +- .../Civi/Api4/Action/Afform/LoadAdminData.php | 2 +- .../Civi/Afform/AfformMetadataInjector.php | 3 +-- .../Api4/Action/Afform/AbstractProcessor.php | 6 ++--- .../core/Civi/Api4/Action/Afform/Get.php | 2 +- .../Civi/Api4/Action/Afform/GetOptions.php | 8 +++---- .../core/Civi/Api4/Action/Afform/Revert.php | 2 +- .../core/Civi/Api4/Action/Afform/Submit.php | 10 ++++---- .../Civi/Api4/Action/Afform/SubmitFile.php | 4 ++-- .../Civi/Api4/Utils/AfformFormatTrait.php | 4 ++-- .../core/Civi/Api4/Utils/AfformSaveTrait.php | 2 +- ext/afform/core/afform.php | 2 +- .../phpunit/api/v4/AfformContactUsageTest.php | 4 ++-- .../tests/phpunit/Civi/Authx/AllFlowsTest.php | 24 +++++++++---------- ext/civigrant/CRM/Grant/BAO/Query.php | 2 +- ext/civigrant/CRM/Grant/Form/Search.php | 6 ++--- ext/civiimport/Civi/Api4/Import.php | 8 +++---- .../contributioncancelactions.php | 9 ++++--- .../tests/phpunit/CancelTest.php | 19 +++++++-------- .../phpunit/CRM/Core/Payment/ElavonTest.php | 2 +- .../CRM/Event/Cart/Form/Checkout/Payment.php | 4 ++-- .../phpunit/CRM/Core/Payment/EwayTest.php | 2 +- ext/financialacls/financialacls.php | 7 +++--- .../Civi/Financialacls/BaseTestClass.php | 6 ++--- .../Financialacls/ContributionSoftTest.php | 7 +++--- .../EntityFinancialAccountTest.php | 2 +- .../Financialacls/FinancialAccountTest.php | 2 +- .../Civi/Financialacls/LineItemTest.php | 2 +- .../Financialacls/MembershipTypesTest.php | 2 +- .../phpunit/Civi/Searches/SampleTest.php | 14 +++++------ .../OAuthClient/AbstractGrantAction.php | 4 ++-- .../Civi/Api4/Action/OAuthClient/Create.php | 2 +- .../Civi/Api4/Action/OAuthClient/Update.php | 2 +- ext/oauth-client/Civi/Api4/OAuthProvider.php | 2 +- .../Civi/OAuth/OAuthTokenFacade.php | 4 ++-- .../tests/phpunit/api/v4/OAuthClientTest.php | 4 ++-- .../CRM/Core/Payment/PayflowProTest.php | 2 +- ext/recaptcha/CRM/Utils/ReCAPTCHA.php | 2 +- .../SearchDisplay/AbstractRunAction.php | 6 ++--- .../Api4/Action/SearchDisplay/Download.php | 2 +- .../Api4/Action/SearchDisplay/GetDefault.php | 2 +- .../Action/SearchDisplay/GetSearchTasks.php | 2 +- .../Civi/Api4/Action/SearchDisplay/Run.php | 2 +- .../api/v4/SearchDisplay/SearchRunTest.php | 2 +- .../SearchRunWithCustomFieldTest.php | 2 +- .../sequentialcreditnotes.php | 5 ++-- .../phpunit/SequentialcreditnotesTest.php | 1 - 47 files changed, 101 insertions(+), 114 deletions(-) diff --git a/bin/ContributionProcessor.php b/bin/ContributionProcessor.php index 3de786f487..00b3776e0b 100644 --- a/bin/ContributionProcessor.php +++ b/bin/ContributionProcessor.php @@ -183,7 +183,7 @@ class CiviContributeProcessor { CRM_Core_Error::debug_log_message("Skipped - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..

", TRUE); } } - catch (CiviCRM_API3_Exception $e) { + catch (CRM_Core_Exception $e) { CRM_Core_Error::debug_log_message("Skipped - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..

", TRUE); } } diff --git a/ext/afform/admin/Civi/Api4/Action/Afform/LoadAdminData.php b/ext/afform/admin/Civi/Api4/Action/Afform/LoadAdminData.php index 9ee74c6585..c1b0f1e8b1 100644 --- a/ext/afform/admin/Civi/Api4/Action/Afform/LoadAdminData.php +++ b/ext/afform/admin/Civi/Api4/Action/Afform/LoadAdminData.php @@ -246,7 +246,7 @@ class LoadAdminData extends \Civi\Api4\Generic\AbstractAction { * @param array $entities * @param array $info * @param array $where - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ private function loadAvailableBlocks($entities, &$info, $where = []) { diff --git a/ext/afform/core/Civi/Afform/AfformMetadataInjector.php b/ext/afform/core/Civi/Afform/AfformMetadataInjector.php index c2b128c62f..48c9264173 100644 --- a/ext/afform/core/Civi/Afform/AfformMetadataInjector.php +++ b/ext/afform/core/Civi/Afform/AfformMetadataInjector.php @@ -100,7 +100,6 @@ class AfformMetadataInjector { * * @param \DOMElement $afField * @param array $fieldInfo - * @throws \API_Exception * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\NotImplementedException */ @@ -167,7 +166,7 @@ class AfformMetadataInjector { * @param string|array $entityNames * @param string $action * @param \DOMElement $afField - * @throws \API_Exception + * @throws \CRM_Core_Exception */ private static function fillFieldMetadata($entityNames, string $action, \DOMElement $afField):void { $fieldName = $afField->getAttribute('name'); diff --git a/ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php b/ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php index 534b4d4903..de9e801625 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/AbstractProcessor.php @@ -62,7 +62,7 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction { /** * @param \Civi\Api4\Generic\Result $result - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function _run(Result $result) { // This will throw an exception if the form doesn't exist or user lacks permission @@ -183,7 +183,7 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction { * @param string $joinEntityType * @param int|string $mainEntityId * @return array - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected static function getJoinWhereClause(FormDataModel $formDataModel, string $mainEntityName, string $joinEntityType, $mainEntityId) { $entity = $formDataModel->getEntity($mainEntityName); @@ -215,7 +215,7 @@ abstract class AbstractProcessor extends \Civi\Api4\Generic\AbstractAction { * @param $entityName * @param $fieldName * @return array|null - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function getEntityField($entityName, $fieldName) { if (!isset(\Civi::$statics[__CLASS__][__FUNCTION__][$entityName])) { diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Get.php b/ext/afform/core/Civi/Api4/Action/Afform/Get.php index 793b6eb578..aa376d8a39 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Get.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Get.php @@ -112,7 +112,7 @@ class Get extends \Civi\Api4\Generic\BasicGetAction { * Generates afform blocks from custom field sets. * * @param \Civi\Core\Event\GenericHookEvent $event - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function getCustomGroupBlocks($event) { // Early return if blocks are not requested diff --git a/ext/afform/core/Civi/Api4/Action/Afform/GetOptions.php b/ext/afform/core/Civi/Api4/Action/Afform/GetOptions.php index 7251d2eb2e..c1498b5e36 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/GetOptions.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/GetOptions.php @@ -44,7 +44,7 @@ class GetOptions extends AbstractProcessor { /** * @return array - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function processForm() { $formEntity = $this->_formDataModel->getEntity($this->modelName); @@ -55,16 +55,16 @@ class GetOptions extends AbstractProcessor { if ($formEntity) { $entity = $this->joinEntity ?: $formEntity['type']; if ($this->joinEntity && !isset($formEntity['joins'][$this->joinEntity]['fields'][$this->fieldName])) { - throw new \API_Exception('Cannot get options for field not present on form'); + throw new \CRM_Core_Exception('Cannot get options for field not present on form'); } elseif (!$this->joinEntity && !isset($formEntity['fields'][$this->fieldName])) { - throw new \API_Exception('Cannot get options for field not present on form'); + throw new \CRM_Core_Exception('Cannot get options for field not present on form'); } } // For search forms, get entity from savedSearch api params elseif ($searchDisplay) { if (!isset($searchDisplay['fields'][$this->fieldName])) { - throw new \API_Exception('Cannot get options for field not present on form'); + throw new \CRM_Core_Exception('Cannot get options for field not present on form'); } $savedSearch = SavedSearch::get(FALSE) ->addWhere('name', '=', $searchDisplay['searchName']) diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Revert.php b/ext/afform/core/Civi/Api4/Action/Afform/Revert.php index 0fbfb399d7..070ecc9ad3 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Revert.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Revert.php @@ -57,7 +57,7 @@ class Revert extends \Civi\Api4\Generic\BasicBatchAction { $metaPath = $scanner->createSiteLocalPath($item['name'], $file); if (file_exists($metaPath)) { if (!@unlink($metaPath)) { - throw new \API_Exception("Failed to remove afform overrides in $file"); + throw new \CRM_Core_Exception("Failed to remove afform overrides in $file"); } } } diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php index 9ab7a5177a..b58f87b435 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php @@ -145,7 +145,7 @@ class Submit extends AbstractProcessor { * across multiple entities (contact + n email addresses). * * @param \Civi\Afform\Event\AfformSubmitEvent $event - * @throws \API_Exception + * @throws \CRM_Core_Exception * @see afform_civicrm_config */ public static function preprocessContact(AfformSubmitEvent $event): void { @@ -172,7 +172,7 @@ class Submit extends AbstractProcessor { /** * @param \Civi\Afform\Event\AfformSubmitEvent $event - * @throws \API_Exception + * @throws \CRM_Core_Exception * @see afform_civicrm_config */ public static function processGenericEntity(AfformSubmitEvent $event) { @@ -187,7 +187,7 @@ class Submit extends AbstractProcessor { $event->setEntityId($index, $saved[$idField]); self::saveJoins($event, $index, $saved[$idField], $record['joins'] ?? []); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { // What to do here? Sometimes we should silently ignore errors, e.g. an optional entity // intentionally left blank. Other times it's a real error the user should know about. } @@ -259,7 +259,7 @@ class Submit extends AbstractProcessor { * @param int $index * @param int|string $entityId * @param array $joins - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected static function saveJoins(AfformSubmitEvent $event, $index, $entityId, $joins) { foreach ($joins as $joinEntityName => $join) { @@ -286,7 +286,7 @@ class Submit extends AbstractProcessor { 'where' => self::getJoinWhereClause($event->getFormDataModel(), $event->getEntityName(), $joinEntityName, $entityId), ]); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { // No records to delete } $event->setJoinIds($index, $joinEntityName, []); diff --git a/ext/afform/core/Civi/Api4/Action/Afform/SubmitFile.php b/ext/afform/core/Civi/Api4/Action/Afform/SubmitFile.php index 967720fbc2..3ccfdd9ff5 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/SubmitFile.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/SubmitFile.php @@ -62,7 +62,7 @@ class SubmitFile extends AbstractProcessor { protected function processForm() { if (empty($_FILES['file'])) { - throw new \API_Exception('File upload required'); + throw new \CRM_Core_Exception('File upload required'); } $afformEntity = $this->_formDataModel->getEntity($this->modelName); $apiEntity = $this->joinEntity ?: $afformEntity['type']; @@ -77,7 +77,7 @@ class SubmitFile extends AbstractProcessor { } if (!$entityId) { - throw new \API_Exception('Entity not found'); + throw new \CRM_Core_Exception('Entity not found'); } $attachmentParams = [ diff --git a/ext/afform/core/Civi/Api4/Utils/AfformFormatTrait.php b/ext/afform/core/Civi/Api4/Utils/AfformFormatTrait.php index 2ed0d3c5c6..143c7edc0f 100644 --- a/ext/afform/core/Civi/Api4/Utils/AfformFormatTrait.php +++ b/ext/afform/core/Civi/Api4/Utils/AfformFormatTrait.php @@ -38,7 +38,7 @@ trait AfformFormatTrait { /** * @param string $html * @return mixed - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function convertHtmlToOutput($html) { if ($this->layoutFormat === 'html') { @@ -51,7 +51,7 @@ trait AfformFormatTrait { /** * @param mixed $mixed * @return string - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function convertInputToHtml($mixed) { if (is_string($mixed)) { diff --git a/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php b/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php index 466705a00d..4f9756828c 100644 --- a/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php +++ b/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php @@ -31,7 +31,7 @@ trait AfformSaveTrait { $orig = NULL; } elseif (!preg_match('/^[a-zA-Z][-_a-zA-Z0-9]*$/', $item['name'])) { - throw new \API_Exception("Afform.{$this->getActionName()}: name should begin with a letter and only contain alphanumerics underscores and dashes."); + throw new \CRM_Core_Exception("Afform.{$this->getActionName()}: name should begin with a letter and only contain alphanumerics underscores and dashes."); } else { // Fetch existing metadata diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index 711f1a43be..16c204bada 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -337,7 +337,7 @@ function afform_civicrm_angularModules(&$angularModules) { * The module definition. * @return array * Array(string $filename => string $html). - * @throws API_Exception + * @throws CRM_Core_Exception */ function _afform_get_partials($moduleName, $module) { $afform = civicrm_api4('Afform', 'get', [ diff --git a/ext/afform/mock/tests/phpunit/api/v4/AfformContactUsageTest.php b/ext/afform/mock/tests/phpunit/api/v4/AfformContactUsageTest.php index 1c1ba056c8..b3219d514d 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/AfformContactUsageTest.php +++ b/ext/afform/mock/tests/phpunit/api/v4/AfformContactUsageTest.php @@ -197,7 +197,7 @@ EOHTML; ->indexBy('name'); $this->fail('Expected authorization exception from Afform.prefill'); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { // Should fail permission check } @@ -211,7 +211,7 @@ EOHTML; ->execute(); $this->fail('Expected authorization exception from Afform.submit'); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { // Should fail permission check } } diff --git a/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php b/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php index be9ed1e498..e4972fe16f 100644 --- a/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php +++ b/ext/authx/tests/phpunit/Civi/Authx/AllFlowsTest.php @@ -111,7 +111,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * The type of credential to put in the `Authorization:` header. * @param string $flowType * The "flow" determines how the credential is added on top of the base-request (e.g. adding a parameter or header). - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getStatelessExamples */ @@ -146,7 +146,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * The type of credential to put in the `Authorization:` header. * @param string $flowType * The "flow" determines how the credential is added on top of the base-request (e.g. adding a parameter or header). - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getStatelessExamples */ @@ -173,7 +173,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf /** * The setting "authx_guard" may be used to require (or not require) the site_key. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ public function testStatelessGuardSiteKey() { @@ -215,7 +215,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * * @param string $credType * The type of credential to put in the login request. - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ @@ -261,7 +261,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * * @param string $credType * The type of credential to put in the login request. - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ @@ -283,7 +283,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * * @param string $credType * The type of credential to put in the login request. - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ @@ -310,7 +310,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * * @param string $credType * The type of credential to put in the login request. - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException * @dataProvider getCredTypes */ @@ -331,7 +331,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * Create a session for $demoCID. Within the session, make a single * stateless request as $lebowskiCID. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ public function testStatefulStatelessOverlap(): void { @@ -422,7 +422,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * This consumer intends to make stateless requests with a handful of different identities, * but their browser happens to be cookie-enabled. Ensure that identities do not leak between requests. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ public function testMultipleStateless(): void { @@ -478,7 +478,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * different identifier fields (authx_user, authx_contact_id), and different * flows (param/header/xheader). * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \GuzzleHttp\Exception\GuzzleException */ public function testJwtMiddleware() { @@ -518,7 +518,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf * * To test this, we call `cv ev 'authx_login(...);'` and check the resulting identity. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public function testCliServiceLogin() { $withCv = function($phpStmt) { @@ -857,7 +857,7 @@ class AllFlowsTest extends \PHPUnit\Framework\TestCase implements EndToEndInterf /** * @return int - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ private function getDemoCID(): int { if (!isset(\Civi::$statics[__CLASS__]['demoId'])) { diff --git a/ext/civigrant/CRM/Grant/BAO/Query.php b/ext/civigrant/CRM/Grant/BAO/Query.php index 503f01e9bd..22c8eb741f 100644 --- a/ext/civigrant/CRM/Grant/BAO/Query.php +++ b/ext/civigrant/CRM/Grant/BAO/Query.php @@ -295,7 +295,7 @@ class CRM_Grant_BAO_Query extends CRM_Contact_BAO_Query_Interface { /** * Get the metadata for fields to be included on the grant search form. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public static function getSearchFieldMetadata() { $fields = [ diff --git a/ext/civigrant/CRM/Grant/Form/Search.php b/ext/civigrant/CRM/Grant/Form/Search.php index 9104bce36a..c59c1875d9 100644 --- a/ext/civigrant/CRM/Grant/Form/Search.php +++ b/ext/civigrant/CRM/Grant/Form/Search.php @@ -66,7 +66,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { * Processing needed for buildForm and later. * * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception */ public function preProcess() { /** @@ -113,7 +112,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { * Build the form object. * * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { parent::buildQuickForm(); @@ -256,7 +254,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { * * @return array * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function getEntityMetadata() { return CRM_Grant_BAO_Query::getSearchFieldMetadata(); @@ -265,7 +263,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { /** * Set the metadata for the form. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function setSearchMetadata() { $this->addSearchFieldMetadata(['Grant' => $this->getEntityMetadata()]); diff --git a/ext/civiimport/Civi/Api4/Import.php b/ext/civiimport/Civi/Api4/Import.php index c44a68a921..8a5d22f723 100644 --- a/ext/civiimport/Civi/Api4/Import.php +++ b/ext/civiimport/Civi/Api4/Import.php @@ -53,7 +53,7 @@ class Import { * @param int $userJobID * @param bool $checkPermissions * @return \Civi\Api4\Import\Save - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function save(int $userJobID, bool $checkPermissions = TRUE): Save { return (new Save('Import_' . $userJobID, __FUNCTION__)) @@ -64,7 +64,7 @@ class Import { * @param int $userJobID * @param bool $checkPermissions * @return \Civi\Api4\Generic\DAOCreateAction - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function create(int $userJobID, bool $checkPermissions = TRUE): Create { return (new Create('Import_' . $userJobID, __FUNCTION__)) @@ -75,7 +75,7 @@ class Import { * @param int $userJobID * @param bool $checkPermissions * @return \Civi\Api4\Import\Update - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function update(int $userJobID, bool $checkPermissions = TRUE): Update { return (new Update('Import_' . $userJobID, __FUNCTION__)) @@ -95,7 +95,7 @@ class Import { /** * @param int $userJobID * @return \Civi\Api4\Generic\CheckAccessAction - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public static function checkAccess(int $userJobID): CheckAccessAction { return new CheckAccessAction('Import_' . $userJobID, __FUNCTION__); diff --git a/ext/contributioncancelactions/contributioncancelactions.php b/ext/contributioncancelactions/contributioncancelactions.php index 76e61d1756..e487e8dea6 100644 --- a/ext/contributioncancelactions/contributioncancelactions.php +++ b/ext/contributioncancelactions/contributioncancelactions.php @@ -17,8 +17,7 @@ use Civi\Api4\Participant; * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post * - * @throws \CiviCRM_API3_Exception - * @throws \API_Exception + * @throws \CRM_Core_Exception */ function contributioncancelactions_civicrm_post($op, $objectName, $objectId, $objectRef) { if ($op === 'edit' && $objectName === 'Contribution' @@ -34,7 +33,7 @@ function contributioncancelactions_civicrm_post($op, $objectName, $objectId, $ob * * @param int $contributionID * - * @throws CiviCRM_API3_Exception + * @throws CRM_Core_Exception */ function contributioncancelactions_cancel_related_pending_participant_records(int $contributionID): void { $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'"); @@ -57,8 +56,8 @@ function contributioncancelactions_cancel_related_pending_participant_records(in * * @param int $contributionID * - * @throws API_Exception - * @throws CiviCRM_API3_Exception + * @throws CRM_Core_Exception + * @throws CRM_Core_Exception */ function contributioncancelactions_cancel_related_pending_memberships(int $contributionID): void { $connectedMemberships = (array) LineItem::get(FALSE)->setWhere([ diff --git a/ext/contributioncancelactions/tests/phpunit/CancelTest.php b/ext/contributioncancelactions/tests/phpunit/CancelTest.php index af6f4a7245..6ae6113080 100644 --- a/ext/contributioncancelactions/tests/phpunit/CancelTest.php +++ b/ext/contributioncancelactions/tests/phpunit/CancelTest.php @@ -68,7 +68,6 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Test that a cancel from paypal pro results in an order being cancelled. * - * @throws \API_Exception * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ @@ -155,7 +154,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Create the general membership type. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function createMembershipType(): void { MembershipType::create()->setValues([ @@ -217,8 +216,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Test that a cancel from paypal pro results in an order being cancelled. * - * @throws \API_Exception - * @throws \CRM_Core_Exception|\CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public function testPaypalStandardCancel(): void { $this->createContact(); @@ -242,7 +240,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Test fail order api. * - * @throws API_Exception + * @throws CRM_Core_Exception */ public function testCancelOrderWithParticipantFailed(): void { $status = 'Failed'; @@ -252,7 +250,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Test cancel order api. * - * @throws API_Exception + * @throws CRM_Core_Exception */ public function testCancelOrderWithParticipantCancelled(): void { $this->markTestIncomplete('For unknown reasons this failed if run after the cancelled variation of this test'); @@ -264,7 +262,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T * Test cancelling a contribution with a membership on the contribution edit * form. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testCancelFromContributionForm(): void { $this->createContact(); @@ -321,7 +319,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T * Create an event and an order for a participant in that event. * * @return int - * @throws API_Exception + * @throws CRM_Core_Exception */ protected function createEventOrder(): int { $this->ids['event'][0] = (int) Event::create()->setValues(['title' => 'Event', 'start_date' => 'tomorrow', 'event_type_id:name' => 'Workshop'])->execute()->first()['id']; @@ -353,7 +351,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Create a contact for use in the test. * - * @throws API_Exception + * @throws CRM_Core_Exception */ protected function createContact(): void { $this->ids['contact'][0] = Civi\Api4\Contact::create()->setValues(['first_name' => 'Brer', 'last_name' => 'Rabbit'])->execute()->first()['id']; @@ -362,8 +360,7 @@ class CancelTest extends TestCase implements HeadlessInterface, HookInterface, T /** * @param string $status * - * @throws \API_Exception - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ protected function createAndUpdateContribution(string $status): void { diff --git a/ext/elavon/tests/phpunit/CRM/Core/Payment/ElavonTest.php b/ext/elavon/tests/phpunit/CRM/Core/Payment/ElavonTest.php index 81fc623ea5..c6a785d390 100644 --- a/ext/elavon/tests/phpunit/CRM/Core/Payment/ElavonTest.php +++ b/ext/elavon/tests/phpunit/CRM/Core/Payment/ElavonTest.php @@ -137,7 +137,7 @@ class CRM_Core_Payment_ElavonTest extends \PHPUnit\Framework\TestCase implements * * @param int|null $id * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function setupMockHandler($id = NULL): void { if ($id) { diff --git a/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php index b61142c29a..49e63c533c 100644 --- a/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php @@ -30,7 +30,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { * @param CRM_Event_BAO_Event $event * * @return mixed - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ public function registerParticipant($params, &$participant, $event) { $participantParams = [ @@ -694,7 +694,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { * @param int $event_id * * @return bool - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function apply_discount($discountCode, &$price_set_amount, &$cost, $event_id) { $extensions = civicrm_api3('Extension', 'get', [ diff --git a/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php b/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php index e80de0cdaf..d0f77adc2d 100644 --- a/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php +++ b/ext/ewaysingle/tests/phpunit/CRM/Core/Payment/EwayTest.php @@ -162,7 +162,7 @@ class CRM_Core_Payment_EwayTest extends \PHPUnit\Framework\TestCase implements H * @param int|null $id * @param bool $error * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function setupMockHandler($id = NULL, $error = FALSE): void { if ($id) { diff --git a/ext/financialacls/financialacls.php b/ext/financialacls/financialacls.php index 45366d57ba..af3378eb49 100644 --- a/ext/financialacls/financialacls.php +++ b/ext/financialacls/financialacls.php @@ -98,7 +98,6 @@ function financialacls_civicrm_entityTypes(&$entityTypes) { * @param int|null $id * @param array $params * - * @throws \API_Exception * @throws \CRM_Core_Exception */ function financialacls_civicrm_pre($op, $objectName, $id, &$params) { @@ -112,7 +111,7 @@ function financialacls_civicrm_pre($op, $objectName, $id, &$params) { $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id'); } if (!array_key_exists($params['financial_type_id'], $types)) { - throw new API_Exception('You do not have permission to ' . $op . ' this line item'); + throw new CRM_Core_Exception('You do not have permission to ' . $op . ' this line item'); } } if ($objectName === 'FinancialType' && !empty($params['id']) && !empty($params['name'])) { @@ -184,7 +183,7 @@ function _financialacls_civicrm_get_accounts_clause(): string { $clause = 'IN (' . implode(',', array_keys($accounts)) . ')'; } } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { // We've already set it to 0 so we can quietly handle this. } } @@ -221,7 +220,7 @@ function _financialacls_civicrm_get_accessible_financial_types(): array { * * @return string * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ function _financialacls_civicrm_get_membership_type_clause(): string { $financialTypes = _financialacls_civicrm_get_accessible_financial_types(); diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/BaseTestClass.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/BaseTestClass.php index 2d923004ad..8aea397324 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/BaseTestClass.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/BaseTestClass.php @@ -43,7 +43,7 @@ class BaseTestClass extends TestCase implements HeadlessInterface, HookInterface } /** - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ public function tearDown(): void { @@ -86,7 +86,7 @@ class BaseTestClass extends TestCase implements HeadlessInterface, HookInterface /** * Create price set. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function createPriceSet(): void { $priceSet = PriceSet::create(FALSE)->setValues([ @@ -121,7 +121,7 @@ class BaseTestClass extends TestCase implements HeadlessInterface, HookInterface /** * Delete extraneous price sets. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function cleanupPriceSets(): void { $addedPriceSets = array_keys((array) PriceSet::get(FALSE) diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/ContributionSoftTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/ContributionSoftTest.php index 03af360df3..1438c21a0c 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/ContributionSoftTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/ContributionSoftTest.php @@ -11,7 +11,7 @@ namespace Civi\Financialacls; // I fought the Autoloader and the autoloader won. -use API_Exception; +use CRM_Core_Exception; use Civi\Api4\Contribution; use Civi\Api4\ContributionSoft; use CRM_Contribute_BAO_ContributionSoft; @@ -29,7 +29,6 @@ class ContributionSoftTest extends BaseTestClass { /** * Test getSoftContributionList method. * - * @throws \API_Exception * @throws \CRM_Core_Exception */ public function testGetSoftContributionList(): void { @@ -151,7 +150,7 @@ class ContributionSoftTest extends BaseTestClass { ]; ContributionSoft::create(FALSE)->setValues($params2)->execute(); } - catch (API_Exception $e) { + catch (CRM_Core_Exception $e) { $this->fail($e->getMessage()); } return []; @@ -163,7 +162,7 @@ class ContributionSoftTest extends BaseTestClass { * @param array $params * * @return int - * @throws \API_Exception + * @throws \CRM_Core_Exception */ private function contributionCreate(array $params): int { return Contribution::create(FALSE)->setValues(array_merge([ diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/EntityFinancialAccountTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/EntityFinancialAccountTest.php index 41f43b2a5f..38fb568ddd 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/EntityFinancialAccountTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/EntityFinancialAccountTest.php @@ -15,7 +15,7 @@ class EntityFinancialAccountTest extends BaseTestClass { /** * Test only accounts with permitted income types can be retrieved. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testGetEntityFinancialAccount(): void { $this->setupLoggedInUserWithLimitedFinancialTypeAccess(); diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/FinancialAccountTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/FinancialAccountTest.php index cc071f93af..1f95ac60b8 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/FinancialAccountTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/FinancialAccountTest.php @@ -15,7 +15,7 @@ class FinancialAccountTest extends BaseTestClass { /** * Test only accounts with permitted income types can be retrieved. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testGetFinancialAccount(): void { $this->setupLoggedInUserWithLimitedFinancialTypeAccess(); diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php index 75d57c8a49..a12d368eba 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/LineItemTest.php @@ -27,7 +27,7 @@ class LineItemTest extends BaseTestClass { * Test api applies permissions on line item actions (delete & get). * * @dataProvider versionThreeAndFour - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testLineItemApiPermissions($version): void { $contact1 = $this->individualCreate(); diff --git a/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php b/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php index 3daf742b60..0d45587232 100644 --- a/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php +++ b/ext/financialacls/tests/phpunit/Civi/Financialacls/MembershipTypesTest.php @@ -36,7 +36,7 @@ class MembershipTypesTest extends BaseTestClass { /** * @return \Civi\Api4\Generic\Result - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ protected function setUpMembershipTypesACLLimited(): Result { diff --git a/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php b/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php index 8ab593b024..9c3ed347d0 100644 --- a/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php +++ b/ext/legacycustomsearches/tests/phpunit/Civi/Searches/SampleTest.php @@ -48,7 +48,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Set up for test. * - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ public function setUp(): void { @@ -111,7 +111,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T * @param array $formValues * @param array $names * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testCount(array $formValues, array $names): void { $this->setupSampleData(); @@ -127,7 +127,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T * @param array $formValues * @param array $names * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testAll(array $formValues, array $names): void { $this->setupSampleData(); @@ -166,7 +166,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T * @param array $formValues * @param array $names * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function testContactIDs(array $formValues, array $names): void { $this->setupSampleData(); @@ -224,9 +224,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T * Test CRM_Contact_Form_Search_Custom_Sample with saved_search_id * With true argument it returns list of contact IDs * - * @throws \API_Exception * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception * @throws \Civi\API\Exception\UnauthorizedException */ public function testSavedSearch(): void { @@ -258,7 +256,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T /** * Set up our sample data. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function setupSampleData(): void { $households = [ @@ -291,7 +289,7 @@ class SampleTest extends TestCase implements HeadlessInterface, HookInterface, T * @return array * IDs of the contacts. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function getContactIDs($names): array { return array_keys((array) Contact::get()->addWhere( diff --git a/ext/oauth-client/Civi/Api4/Action/OAuthClient/AbstractGrantAction.php b/ext/oauth-client/Civi/Api4/Action/OAuthClient/AbstractGrantAction.php index 31352dc191..a5b2240cad 100644 --- a/ext/oauth-client/Civi/Api4/Action/OAuthClient/AbstractGrantAction.php +++ b/ext/oauth-client/Civi/Api4/Action/OAuthClient/AbstractGrantAction.php @@ -52,11 +52,11 @@ abstract class AbstractGrantAction extends \Civi\Api4\Generic\AbstractBatchActio } /** - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function validate() { if (!preg_match(OAuthTokenFacade::STORAGE_TYPES, $this->storage)) { - throw new \API_Exception("Invalid token storage ($this->storage)"); + throw new \CRM_Core_Exception("Invalid token storage ($this->storage)"); } } diff --git a/ext/oauth-client/Civi/Api4/Action/OAuthClient/Create.php b/ext/oauth-client/Civi/Api4/Action/OAuthClient/Create.php index 89175a75d0..6ab50fd3b7 100644 --- a/ext/oauth-client/Civi/Api4/Action/OAuthClient/Create.php +++ b/ext/oauth-client/Civi/Api4/Action/OAuthClient/Create.php @@ -11,7 +11,7 @@ class Create extends \Civi\Api4\Generic\DAOCreateAction { if (isset($this->values['provider'])) { $ps = \CRM_OAuth_BAO_OAuthClient::getProviders(); if (!isset($ps[$this->values['provider']])) { - throw new \API_Exception("Invalid provider name: " . $this->values['provider']); + throw new \CRM_Core_Exception("Invalid provider name: " . $this->values['provider']); } } parent::validateValues(); diff --git a/ext/oauth-client/Civi/Api4/Action/OAuthClient/Update.php b/ext/oauth-client/Civi/Api4/Action/OAuthClient/Update.php index 8131f6f0c9..731ecdb060 100644 --- a/ext/oauth-client/Civi/Api4/Action/OAuthClient/Update.php +++ b/ext/oauth-client/Civi/Api4/Action/OAuthClient/Update.php @@ -13,7 +13,7 @@ class Update extends \Civi\Api4\Generic\DAOUpdateAction { if (isset($this->values['provider'])) { $ps = \CRM_OAuth_BAO_OAuthClient::getProviders(); if (!isset($ps[$this->values['provider']])) { - throw new \API_Exception("Invalid provider name: " . $this->values['provider']); + throw new \CRM_Core_Exception("Invalid provider name: " . $this->values['provider']); } } diff --git a/ext/oauth-client/Civi/Api4/OAuthProvider.php b/ext/oauth-client/Civi/Api4/OAuthProvider.php index 7ef1b7ea2d..6b3cc67a79 100644 --- a/ext/oauth-client/Civi/Api4/OAuthProvider.php +++ b/ext/oauth-client/Civi/Api4/OAuthProvider.php @@ -25,7 +25,7 @@ class OAuthProvider extends Generic\AbstractEntity { foreach ($providers as $name => &$provider) { if ($provider['name'] !== $name) { - throw new \API_Exception(sprintf("Mismatched OAuth provider names: \"%s\" vs \"%s\"", + throw new \CRM_Core_Exception(sprintf("Mismatched OAuth provider names: \"%s\" vs \"%s\"", $provider['name'], $name)); } if (!isset($provider['class'])) { diff --git a/ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php b/ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php index 58a9c3edd2..679599c0e3 100644 --- a/ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php +++ b/ext/oauth-client/Civi/OAuth/OAuthTokenFacade.php @@ -24,13 +24,13 @@ class OAuthTokenFacade { * (via getAccessToken($tokenOptions)), eg "username", "password", "code" * * @return array - * @throws \API_Exception + * @throws \CRM_Core_Exception * @see \League\OAuth2\Client\Provider\AbstractProvider::getAccessToken() */ public function init($options): array { $options['storage'] = $options['storage'] ?? 'OAuthSysToken'; if (!preg_match(self::STORAGE_TYPES, $options['storage'])) { - throw new \API_Exception("Invalid token storage ({$options['storage']})"); + throw new \CRM_Core_Exception("Invalid token storage ({$options['storage']})"); } /** @var \League\OAuth2\Client\Provider\GenericProvider $provider */ diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php index cb7e0eb0fa..b9186dac99 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthClientTest.php @@ -78,7 +78,7 @@ class api_v4_OAuthClientTest extends \PHPUnit\Framework\TestCase implements Head ])->execute(); $this->fail("Expected exception: invalid provider"); } - catch (API_Exception $e) { + catch (CRM_Core_Exception $e) { $this->assertRegExp(';Invalid provider;', $e->getMessage()); } } @@ -104,7 +104,7 @@ class api_v4_OAuthClientTest extends \PHPUnit\Framework\TestCase implements Head ->execute(); $this->fail("Expected exception: invalid provider"); } - catch (API_Exception $e) { + catch (CRM_Core_Exception $e) { $this->assertRegExp(';Invalid provider;', $e->getMessage()); } diff --git a/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php b/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php index 5bff55fa9c..4021911608 100644 --- a/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php +++ b/ext/payflowpro/tests/phpunit/CRM/Core/Payment/PayflowProTest.php @@ -200,7 +200,7 @@ class CRM_Core_Payment_PayflowProTest extends \PHPUnit\Framework\TestCase implem * @param bool $error * @param bool $recurring * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ protected function setupMockHandler($id = NULL, $error = FALSE, $recurring = FALSE): void { if ($id) { diff --git a/ext/recaptcha/CRM/Utils/ReCAPTCHA.php b/ext/recaptcha/CRM/Utils/ReCAPTCHA.php index cd99e32f73..f631733ad9 100644 --- a/ext/recaptcha/CRM/Utils/ReCAPTCHA.php +++ b/ext/recaptcha/CRM/Utils/ReCAPTCHA.php @@ -133,7 +133,7 @@ class CRM_Utils_ReCAPTCHA { * @param string $formName * @param CRM_Core_Form $form * - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\UnauthorizedException */ public static function checkAndAddCaptchaToForm($formName, &$form) { diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php index b06f67c819..19192cd314 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php @@ -87,7 +87,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction { /** * @param \Civi\Api4\Generic\Result $result * @throws UnauthorizedException - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function _run(\Civi\Api4\Generic\Result $result) { // Only SearchKit admins can use this in unsecured "preview mode" @@ -648,7 +648,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction { 'values' => $entityValues, ])->count(); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { return FALSE; } } @@ -1109,7 +1109,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction { * * @param $fieldName * @param $value - * @throws \API_Exception + * @throws \CRM_Core_Exception * @throws \Civi\API\Exception\NotImplementedException */ private function addFilterLabel($fieldName, $value) { diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php index 2400ad46c8..6a107a5b71 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Download.php @@ -47,7 +47,7 @@ class Download extends AbstractRunAction { /** * @param \Civi\Api4\Result\SearchDisplayRunResult $result - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function processResult(\Civi\Api4\Result\SearchDisplayRunResult $result) { $entityName = $this->savedSearch['api_entity']; diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetDefault.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetDefault.php index 2f387cfce7..937041bd19 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetDefault.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetDefault.php @@ -40,7 +40,7 @@ class GetDefault extends \Civi\Api4\Generic\AbstractAction { /** * @param \Civi\Api4\Generic\Result $result * @throws UnauthorizedException - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function _run(\Civi\Api4\Generic\Result $result) { // Only SearchKit admins can use this in unsecured "preview mode" diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php index 97fb5292f3..e3c7b03af9 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/GetSearchTasks.php @@ -21,7 +21,7 @@ class GetSearchTasks extends \Civi\Api4\Generic\AbstractAction { /** * @param \Civi\Api4\Generic\Result $result - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function _run(\Civi\Api4\Generic\Result $result) { // Adding checkPermissions filters out actions the user is not allowed to perform diff --git a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Run.php b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Run.php index 3d631321e6..9406c67ea9 100644 --- a/ext/search_kit/Civi/Api4/Action/SearchDisplay/Run.php +++ b/ext/search_kit/Civi/Api4/Action/SearchDisplay/Run.php @@ -32,7 +32,7 @@ class Run extends AbstractRunAction { /** * @param \Civi\Api4\Result\SearchDisplayRunResult $result - * @throws \API_Exception + * @throws \CRM_Core_Exception */ protected function processResult(\Civi\Api4\Result\SearchDisplayRunResult $result) { $entityName = $this->savedSearch['api_entity']; diff --git a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php index 36fe1d73f1..646e9033be 100644 --- a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php +++ b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php @@ -793,7 +793,7 @@ class SearchRunTest extends \PHPUnit\Framework\TestCase implements HeadlessInter civicrm_api4('SearchDisplay', 'run', $params); $this->fail(); } - catch (\API_Exception $e) { + catch (\CRM_Core_Exception $e) { } // With a random seed, results should be shuffled in stable order diff --git a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunWithCustomFieldTest.php b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunWithCustomFieldTest.php index 3b5bda71fc..f323394f53 100644 --- a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunWithCustomFieldTest.php +++ b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunWithCustomFieldTest.php @@ -25,7 +25,7 @@ class SearchRunWithCustomFieldTest extends CustomTestBase { /** * Delete all created custom groups. * - * @throws \API_Exception + * @throws \CRM_Core_Exception */ public function tearDown(): void { // Core bug: `civicrm_entity_file` doesn't get cleaned up when a contact is deleted, diff --git a/ext/sequentialcreditnotes/sequentialcreditnotes.php b/ext/sequentialcreditnotes/sequentialcreditnotes.php index efb3d3cd38..b7ba79d7dc 100644 --- a/ext/sequentialcreditnotes/sequentialcreditnotes.php +++ b/ext/sequentialcreditnotes/sequentialcreditnotes.php @@ -15,8 +15,7 @@ use Civi\Api4\Contribution; * @param int|null $id * @param array $params * - * @throws \CiviCRM_API3_Exception - * @throws \API_Exception + * @throws \CRM_Core_Exception */ function sequentialcreditnotes_civicrm_pre($op, $objectName, $id, &$params) { if ($objectName === 'Contribution' && !empty($params['contribution_status_id'])) { @@ -41,7 +40,7 @@ function sequentialcreditnotes_civicrm_pre($op, $objectName, $id, &$params) { * @return string * Credit Note Id. * - * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception */ function sequentialcreditnotes_create_credit_note_id() { diff --git a/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php b/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php index 58bda954fd..d33bc07eb5 100644 --- a/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php +++ b/ext/sequentialcreditnotes/tests/phpunit/SequentialcreditnotesTest.php @@ -43,7 +43,6 @@ class SequentialcreditnotesTest extends \PHPUnit\Framework\TestCase implements H * createCreditNoteId(); * * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception */ public function testCreateCreditNoteId(): void { $this->_apiversion = 4; -- 2.25.1