diff --git a/application/Espo/Controllers/FieldManager.php b/application/Espo/Controllers/FieldManager.php index d3ee336ff3..b7ef0fdeb1 100644 --- a/application/Espo/Controllers/FieldManager.php +++ b/application/Espo/Controllers/FieldManager.php @@ -106,8 +106,7 @@ class FieldManager try { $this->rebuild($scope); - } - catch (Error $e) { + } catch (Error $e) { $fieldManagerTool->delete($scope, $name); throw new Error($e->getMessage()); diff --git a/application/Espo/Core/Upgrades/Migrations/V8_3/AfterUpgrade.php b/application/Espo/Core/Upgrades/Migrations/V8_3/AfterUpgrade.php index 1529694080..28fdcc3552 100644 --- a/application/Espo/Core/Upgrades/Migrations/V8_3/AfterUpgrade.php +++ b/application/Espo/Core/Upgrades/Migrations/V8_3/AfterUpgrade.php @@ -137,8 +137,7 @@ class AfterUpgrade implements Script if ($schemaManager->tablesExist('stream_subscription')) { try { $schemaManager->dropTable('stream_subscription'); - } - catch (DbalException) { + } catch (DbalException) { $schemaManager->renameTable('stream_subscription', 'stream_subscription_waste'); } } diff --git a/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php b/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php index 6057c860a6..a53ce0026c 100644 --- a/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php +++ b/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php @@ -108,8 +108,7 @@ class ConfigWriterFileManager { try { $data = $this->fileManager->getPhpContents($path); - } - catch (RuntimeException) { + } catch (RuntimeException) { return false; } diff --git a/application/Espo/Core/Utils/Database/Schema/RebuildActions/PrepareForFulltextIndex.php b/application/Espo/Core/Utils/Database/Schema/RebuildActions/PrepareForFulltextIndex.php index ce5d4d7b78..8732b4a1f1 100644 --- a/application/Espo/Core/Utils/Database/Schema/RebuildActions/PrepareForFulltextIndex.php +++ b/application/Espo/Core/Utils/Database/Schema/RebuildActions/PrepareForFulltextIndex.php @@ -73,8 +73,7 @@ class PrepareForFulltextIndex implements RebuildAction try { /** @var array{Type: string, Collation: string} $row */ $row = $connection->fetchAssociative($sql); - } - catch (Exception) { + } catch (Exception) { continue; } diff --git a/application/Espo/Core/Utils/File/Permission.php b/application/Espo/Core/Utils/File/Permission.php index c5bdcc88f8..1129ec8e34 100644 --- a/application/Espo/Core/Utils/File/Permission.php +++ b/application/Espo/Core/Utils/File/Permission.php @@ -519,8 +519,7 @@ class Permission try { $this->chmod($path, $this->writablePermissions, $options['recursive']); - } - catch (Throwable) {} + } catch (Throwable) {} /** check is writable */ $res = is_writable($path); @@ -532,8 +531,7 @@ class Permission $res &= $this->fileManager->putContents($path . '/' . $name, 'test'); $res &= $this->fileManager->removeFile($name, $path); - } - catch (Throwable) { + } catch (Throwable) { $res = false; } } diff --git a/application/Espo/Core/Utils/File/Unifier.php b/application/Espo/Core/Utils/File/Unifier.php index 3c832d52aa..7cd9f9fbfa 100644 --- a/application/Espo/Core/Utils/File/Unifier.php +++ b/application/Espo/Core/Utils/File/Unifier.php @@ -235,8 +235,7 @@ class Unifier try { return Json::decode($fileContent, !$this->useObjects); - } - catch (JsonException) { + } catch (JsonException) { throw new JsonException("JSON syntax error in '$path'."); } } diff --git a/application/Espo/Core/Utils/ScheduledJob.php b/application/Espo/Core/Utils/ScheduledJob.php index f06327f459..c24361ea31 100644 --- a/application/Espo/Core/Utils/ScheduledJob.php +++ b/application/Espo/Core/Utils/ScheduledJob.php @@ -135,8 +135,7 @@ class ScheduledJob try { $r1From = new DateTime('-' . $this->checkingCronPeriod); $r1To = new DateTime('+' . $this->checkingCronPeriod); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException(); } diff --git a/application/Espo/Core/Utils/Util.php b/application/Espo/Core/Utils/Util.php index 4111b23e0c..37805744e2 100644 --- a/application/Espo/Core/Utils/Util.php +++ b/application/Espo/Core/Utils/Util.php @@ -633,8 +633,7 @@ class Util $data[8] = chr(ord($data[8]) & 0x3f | 0x80); $hex = bin2hex($data); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException("Could not generate UUID."); } diff --git a/application/Espo/Entities/ExternalAccount.php b/application/Espo/Entities/ExternalAccount.php index 1493d25b19..95419282be 100644 --- a/application/Espo/Entities/ExternalAccount.php +++ b/application/Espo/Entities/ExternalAccount.php @@ -97,8 +97,7 @@ class ExternalAccount extends Integration try { return DateTime::fromString($raw); - } - catch (RuntimeException) { + } catch (RuntimeException) { return null; } } diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.php index 6d37e67d41..9d23910692 100644 --- a/application/Espo/EntryPoints/Image.php +++ b/application/Espo/EntryPoints/Image.php @@ -332,8 +332,7 @@ class Image implements EntryPoint case 'image/webp': try { $sourceImage = imagecreatefromwebp($filePath); - } - catch (Throwable) { + } catch (Throwable) { return null; } diff --git a/application/Espo/Hooks/Common/Formula.php b/application/Espo/Hooks/Common/Formula.php index d030913237..237c0eaa93 100644 --- a/application/Espo/Hooks/Common/Formula.php +++ b/application/Espo/Hooks/Common/Formula.php @@ -79,8 +79,7 @@ class Formula implements BeforeSave { try { $this->formulaManager->run($script, $entity, $variables); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->critical('Before-save formula script failed. {message}', [ 'message' => $e->getMessage(), 'exception' => $e, diff --git a/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/CalendarGroup/UserIsBusyType.php b/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/CalendarGroup/UserIsBusyType.php index a37501a133..f77a1e4d5d 100644 --- a/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/CalendarGroup/UserIsBusyType.php +++ b/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/CalendarGroup/UserIsBusyType.php @@ -87,8 +87,7 @@ class UserIsBusyType implements Func try { $ranges = $this->service->fetchBusyRanges($userId, $params, $ignoreList); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Classes/Select/Call/PrimaryFilters/Todays.php b/application/Espo/Modules/Crm/Classes/Select/Call/PrimaryFilters/Todays.php index e90377a372..69ad8d751d 100644 --- a/application/Espo/Modules/Crm/Classes/Select/Call/PrimaryFilters/Todays.php +++ b/application/Espo/Modules/Crm/Classes/Select/Call/PrimaryFilters/Todays.php @@ -29,6 +29,7 @@ namespace Espo\Modules\Crm\Classes\Select\Call\PrimaryFilters; +use Espo\Core\Exceptions\BadRequest; use Espo\Core\Exceptions\Error; use Espo\Entities\User; @@ -63,8 +64,7 @@ class Todays implements Filter $whereItem = $this->converterFactory ->create(Call::ENTITY_TYPE, $this->user) ->convert($queryBuilder, $item); - } - catch (Error $e) { + } catch (BadRequest $e) { throw new LogicException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Controllers/Document.php b/application/Espo/Modules/Crm/Controllers/Document.php index 4e236396a8..775a47f5be 100644 --- a/application/Espo/Modules/Crm/Controllers/Document.php +++ b/application/Espo/Modules/Crm/Controllers/Document.php @@ -69,8 +69,7 @@ class Document extends Record $parentType, $relatedType ); - } - catch (Error $e) { + } catch (Error $e) { throw new BadRequest($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Controllers/KnowledgeBaseArticle.php b/application/Espo/Modules/Crm/Controllers/KnowledgeBaseArticle.php index 10ce4629a1..181bd3bbda 100644 --- a/application/Espo/Modules/Crm/Controllers/KnowledgeBaseArticle.php +++ b/application/Espo/Modules/Crm/Controllers/KnowledgeBaseArticle.php @@ -68,8 +68,7 @@ class KnowledgeBaseArticle extends Record $parentType, $relatedType ); - } - catch (Error $e) { + } catch (Error $e) { throw new BadRequest($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Jobs/ProcessMassEmail.php b/application/Espo/Modules/Crm/Jobs/ProcessMassEmail.php index a02f7ed211..e7b62816dd 100644 --- a/application/Espo/Modules/Crm/Jobs/ProcessMassEmail.php +++ b/application/Espo/Modules/Crm/Jobs/ProcessMassEmail.php @@ -72,8 +72,7 @@ class ProcessMassEmail implements JobDataLess foreach ($pendingMassEmailList as $massEmail) { try { $this->queue->create($massEmail); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( 'Job ProcessMassEmail#createQueue ' . $massEmail->getId() . ': [' . $e->getCode() . '] ' . $e->getMessage() @@ -91,8 +90,7 @@ class ProcessMassEmail implements JobDataLess foreach ($massEmailList as $massEmail) { try { $this->processor->process($massEmail); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( 'Job ProcessMassEmail#processSending '. $massEmail->getId() . ': [' . $e->getCode() . '] ' . $e->getMessage() diff --git a/application/Espo/Modules/Crm/Jobs/SubmitPopupReminders.php b/application/Espo/Modules/Crm/Jobs/SubmitPopupReminders.php index 3e2cd1c233..4bd92da817 100644 --- a/application/Espo/Modules/Crm/Jobs/SubmitPopupReminders.php +++ b/application/Espo/Modules/Crm/Jobs/SubmitPopupReminders.php @@ -154,8 +154,7 @@ class SubmitPopupReminders implements JobDataLess try { $this->webSocketSubmission ->submit('popupNotifications.event', $userId, (object) ['list' => $list]); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error('Job SubmitPopupReminders: [' . $e->getCode() . '] ' .$e->getMessage()); } } diff --git a/application/Espo/Modules/Crm/Tools/Activities/Service.php b/application/Espo/Modules/Crm/Tools/Activities/Service.php index f60edae9de..51e5ad62d4 100644 --- a/application/Espo/Modules/Crm/Tools/Activities/Service.php +++ b/application/Espo/Modules/Crm/Tools/Activities/Service.php @@ -211,8 +211,7 @@ class Service 'usersLeftMiddle.callId:' => 'call.id', ] ); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -288,8 +287,7 @@ class Service ->where([ 'usersLeftMiddle.userId' => $entity->getId(), ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -352,8 +350,7 @@ class Service 'createdAt', ['false', 'hasAttachment'], ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -481,8 +478,7 @@ class Service 'createdAt', 'hasAttachment', ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -1079,8 +1075,7 @@ class Service 'createdAt', ['false', 'hasAttachment'], ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Tools/Calendar/Service.php b/application/Espo/Modules/Crm/Tools/Calendar/Service.php index db5c120225..a9a13167aa 100644 --- a/application/Espo/Modules/Crm/Tools/Calendar/Service.php +++ b/application/Espo/Modules/Crm/Tools/Calendar/Service.php @@ -309,8 +309,7 @@ class Service ], ], ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -389,8 +388,7 @@ class Service ], ]) ->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } } @@ -455,8 +453,7 @@ class Service ], ]) ->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } } @@ -519,8 +516,7 @@ class Service ], ], ]); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -576,8 +572,7 @@ class Service $fetchParams->withScopeList($brScopeList), array_filter($eventList, fn (Item $item) => $item instanceof Event) ); - } - catch (Exception $e) { + } catch (Exception $e) { if ($e instanceof Forbidden) { continue; } @@ -739,8 +734,7 @@ class Service foreach ($userIdList as $userId) { try { $userItemList = $this->fetch($userId, $fetchParams); - } - catch (Exception $e) { + } catch (Exception $e) { if ($e instanceof Forbidden) { continue; } @@ -858,8 +852,7 @@ class Service ]; $rangeList[] = $busyItem; - } - catch (Exception) {} + } catch (Exception) {} } return array_map( @@ -958,8 +951,7 @@ class Service if ($diff->days > $this->config->get('busyRangesMaxRange', self::BUSY_RANGES_MAX_RANGE_DAYS)) { $toReturn = false; } - } - catch (Exception) { + } catch (Exception) { throw new Error("BusyRanges: Bad date range."); } @@ -1005,8 +997,7 @@ class Service $busyRangeList = $toReturn ? $this->fetchBusyRanges($userId, $fetchParams, $ignoreList) : []; - } - catch (Exception $e) { + } catch (Exception $e) { if ($e instanceof Forbidden) { continue; } diff --git a/application/Espo/Modules/Crm/Tools/Case/Service.php b/application/Espo/Modules/Crm/Tools/Case/Service.php index 14173d6fe6..823e2d8575 100644 --- a/application/Espo/Modules/Crm/Tools/Case/Service.php +++ b/application/Espo/Modules/Crm/Tools/Case/Service.php @@ -233,8 +233,7 @@ class Service 'id' => $contactIdList, ]) ->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Tools/Lead/ConvertService.php b/application/Espo/Modules/Crm/Tools/Lead/ConvertService.php index 579ebad255..2613ab9be4 100644 --- a/application/Espo/Modules/Crm/Tools/Lead/ConvertService.php +++ b/application/Espo/Modules/Crm/Tools/Lead/ConvertService.php @@ -446,8 +446,7 @@ class ConvertService try { $opportunity = $service->create($values, CreateParams::create()->withSkipDuplicateCheck()); - } - catch (BadRequest|Conflict $e) { + } catch (BadRequest|Conflict $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Tools/Opportunity/Report/ByLeadSource.php b/application/Espo/Modules/Crm/Tools/Opportunity/Report/ByLeadSource.php index 61187382ff..b29cddecd3 100644 --- a/application/Espo/Modules/Crm/Tools/Opportunity/Report/ByLeadSource.php +++ b/application/Espo/Modules/Crm/Tools/Opportunity/Report/ByLeadSource.php @@ -80,8 +80,7 @@ class ByLeadSource ->from(Opportunity::ENTITY_TYPE) ->withStrictAccessControl() ->buildQueryBuilder(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php b/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php index bb454c877a..56b7263512 100644 --- a/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php +++ b/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php @@ -147,8 +147,7 @@ class SalesByMonth try { $dt = new DateTime($key . '-01'); - } - catch (Exception $e) { + } catch (Exception $e) { throw new LogicException(); } diff --git a/application/Espo/Modules/Crm/Tools/Opportunity/Service.php b/application/Espo/Modules/Crm/Tools/Opportunity/Service.php index 785f0cf23c..bbadf98e24 100644 --- a/application/Espo/Modules/Crm/Tools/Opportunity/Service.php +++ b/application/Espo/Modules/Crm/Tools/Opportunity/Service.php @@ -163,8 +163,7 @@ class Service 'id' => $contactIdList, ]) ->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/ORM/TransactionManager.php b/application/Espo/ORM/TransactionManager.php index 6a3d3aa49a..611a1e1a23 100644 --- a/application/Espo/ORM/TransactionManager.php +++ b/application/Espo/ORM/TransactionManager.php @@ -73,8 +73,7 @@ class TransactionManager $result = $function(); $this->commit(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->rollback(); /** diff --git a/application/Espo/Services/ExternalAccount.php b/application/Espo/Services/ExternalAccount.php index dbd0cfd4dc..5fd6e7a994 100644 --- a/application/Espo/Services/ExternalAccount.php +++ b/application/Espo/Services/ExternalAccount.php @@ -96,8 +96,7 @@ class ExternalAccount extends Record implements Di\HookManagerAware /** @var @bool */ return $client->ping(); } - } - catch (Exception) {} + } catch (Exception) {} return false; } diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php index 0d99b9c9b8..89a4b4d163 100644 --- a/application/Espo/Services/User.php +++ b/application/Espo/Services/User.php @@ -156,8 +156,7 @@ class User extends Record } $this->getPasswordService()->sendAccessInfoForNewUser($user); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error("Could not send user access info. " . $e->getMessage()); } @@ -192,8 +191,7 @@ class User extends Record if ($user->isActive() && !empty($data->sendAccessInfo)) { $this->sendPassword($user, $newPassword); } - } - catch (Exception) {} + } catch (Exception) {} } return $user; diff --git a/application/Espo/Tools/App/Api/PostDestroyAuthToken.php b/application/Espo/Tools/App/Api/PostDestroyAuthToken.php index cf3483f543..44cd32a5ef 100644 --- a/application/Espo/Tools/App/Api/PostDestroyAuthToken.php +++ b/application/Espo/Tools/App/Api/PostDestroyAuthToken.php @@ -58,8 +58,7 @@ class PostDestroyAuthToken implements Action try { $authentication->destroyAuthToken($token, $request, $response); - } - catch (NotFound) { + } catch (NotFound) { return $response->writeBody(Json::encode(false)); } diff --git a/application/Espo/Tools/Attachment/Api/PostFromImageUrl.php b/application/Espo/Tools/Attachment/Api/PostFromImageUrl.php index 8bffd094ab..fe4d390640 100644 --- a/application/Espo/Tools/Attachment/Api/PostFromImageUrl.php +++ b/application/Espo/Tools/Attachment/Api/PostFromImageUrl.php @@ -60,8 +60,7 @@ class PostFromImageUrl implements Action try { $fieldData = new FieldData($field, $parentType, $relatedType); - } - catch (Error $e) { + } catch (Error $e) { throw new BadRequest($e->getMessage()); } diff --git a/application/Espo/Tools/Attachment/UploadService.php b/application/Espo/Tools/Attachment/UploadService.php index ee8beadc19..13f96bfdac 100644 --- a/application/Espo/Tools/Attachment/UploadService.php +++ b/application/Espo/Tools/Attachment/UploadService.php @@ -144,8 +144,7 @@ class UploadService if ($this->detailsObtainer->getFieldType($attachment) === FieldType::IMAGE) { try { $this->checker->checkTypeImage($attachment, $filePath); - } - catch (Forbidden $e) { + } catch (Forbidden $e) { $this->entityManager->removeEntity($attachment); throw new ForbiddenSilent($e->getMessage()); diff --git a/application/Espo/Tools/Email/AddressService.php b/application/Espo/Tools/Email/AddressService.php index f1d7c91204..ce5b818615 100644 --- a/application/Espo/Tools/Email/AddressService.php +++ b/application/Espo/Tools/Email/AddressService.php @@ -234,8 +234,7 @@ class AddressService ->where($whereClause) ->order('name') ->limit(0, $limit); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Tools/Email/Api/PostAttachmentsCopy.php b/application/Espo/Tools/Email/Api/PostAttachmentsCopy.php index a09a382045..2c9ca4c876 100644 --- a/application/Espo/Tools/Email/Api/PostAttachmentsCopy.php +++ b/application/Espo/Tools/Email/Api/PostAttachmentsCopy.php @@ -65,8 +65,7 @@ class PostAttachmentsCopy implements Action try { $fieldData = new FieldData($field, $parentType, $relatedType); - } - catch (Error $e) { + } catch (Error $e) { throw new BadRequest($e->getMessage()); } diff --git a/application/Espo/Tools/Email/InboxService.php b/application/Espo/Tools/Email/InboxService.php index ef38d2d901..bd0a77c749 100644 --- a/application/Espo/Tools/Email/InboxService.php +++ b/application/Espo/Tools/Email/InboxService.php @@ -68,8 +68,7 @@ class InboxService foreach ($idList as $id) { try { $this->moveToFolder($id, $folderId, $userId); - } - catch (Exception) {} + } catch (Exception) {} } } @@ -110,8 +109,7 @@ class InboxService if ($folderId && str_starts_with($folderId, 'group:')) { try { $this->moveToGroupFolder($email, substr($folderId, 6), $user); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->debug("Could not move email to group folder. " . $e->getMessage()); throw $e; @@ -504,8 +502,7 @@ class InboxService ->getRDBRepository(Email::ENTITY_TYPE) ->clone($itemSelectBuilder->build()) ->count(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } } diff --git a/application/Espo/Tools/Email/SendService.php b/application/Espo/Tools/Email/SendService.php index 985bf84552..3ea6d78e64 100644 --- a/application/Espo/Tools/Email/SendService.php +++ b/application/Espo/Tools/Email/SendService.php @@ -232,8 +232,7 @@ class SendService ->withParams($params) ->withMessage($message) ->send($entity); - } - catch (Exception $e) { + } catch (Exception $e) { $entity->setStatus(Email::STATUS_DRAFT); $this->entityManager->saveEntity($entity, [SaveOption::SILENT => true]); @@ -309,8 +308,7 @@ class SendService try { $this->groupAccountService->storeSentMessage($id, $message); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error( "Email sending: Could not store sent email (Group Email Account {$groupAccount->getId()}): " . $e->getMessage() . "." @@ -327,8 +325,7 @@ class SendService try { $this->personalAccountService->storeSentMessage($id, $message); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error( "Email sending: Could not store sent email (Email Account {$personalAccount->getId()}): " . $e->getMessage() . "." @@ -474,8 +471,7 @@ class SendService $this->emailSender ->withSmtpParams($params) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->warning("Email sending:" . $e->getMessage() . "; " . $e->getCode()); if ($e instanceof SendingError) { @@ -607,8 +603,7 @@ class SendService try { $handler = $this->injectableFactory->create($handlerClassName); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "Email sending: Could not create Smtp Handler for $emailAddress. Error: " . $e->getMessage() . "." diff --git a/application/Espo/Tools/EmailNotification/AssignmentProcessor.php b/application/Espo/Tools/EmailNotification/AssignmentProcessor.php index c68f324ed1..f7e72736ca 100644 --- a/application/Espo/Tools/EmailNotification/AssignmentProcessor.php +++ b/application/Espo/Tools/EmailNotification/AssignmentProcessor.php @@ -182,8 +182,7 @@ class AssignmentProcessor try { $this->emailSender->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('EmailNotification: [' . $e->getCode() . '] ' . $e->getMessage()); } } diff --git a/application/Espo/Tools/EmailNotification/Processor.php b/application/Espo/Tools/EmailNotification/Processor.php index 09f262c869..81a8385a2a 100644 --- a/application/Espo/Tools/EmailNotification/Processor.php +++ b/application/Espo/Tools/EmailNotification/Processor.php @@ -369,8 +369,7 @@ class Processor $this->emailSender ->withParams($senderParams) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage()); } } @@ -583,8 +582,7 @@ class Processor $this->emailSender ->withParams($senderParams) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage()); } } @@ -739,8 +737,7 @@ class Processor $this->emailSender ->withParams($senderParams) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage()); } } @@ -880,8 +877,7 @@ class Processor $this->emailSender ->withParams($senderParams) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage()); } } diff --git a/application/Espo/Tools/EmailTemplate/Processor.php b/application/Espo/Tools/EmailTemplate/Processor.php index 10bd928b9c..64258036f8 100644 --- a/application/Espo/Tools/EmailTemplate/Processor.php +++ b/application/Espo/Tools/EmailTemplate/Processor.php @@ -347,8 +347,7 @@ class Processor try { $hasAccess = $this->aclManager->checkEntityRead($user, $relatedEntity); - } - catch (Exception) { + } catch (Exception) { continue; } diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.php index 6bb4255824..033c92a32e 100644 --- a/application/Espo/Tools/EntityManager/EntityManager.php +++ b/application/Espo/Tools/EntityManager/EntityManager.php @@ -542,8 +542,7 @@ class EntityManager foreach ($this->metadata->get(['entityDefs', $name, 'links'], []) as $link => $item) { try { $this->linkManager->delete(['entity' => $name, 'link' => $link]); - } - catch (Exception) {} + } catch (Exception) {} } $this->fileManager->removeFile("custom/Espo/Custom/Resources/metadata/entityDefs/$name.json"); @@ -582,8 +581,7 @@ class EntityManager $this->baseLanguage->delete('Global', 'scopeNames', $name); $this->baseLanguage->delete('Global', 'scopeNamesPlural', $name); - } - catch (Exception) {} + } catch (Exception) {} $this->metadata->save(); $this->language->save(); diff --git a/application/Espo/Tools/EntityManager/Rename/Renamer.php b/application/Espo/Tools/EntityManager/Rename/Renamer.php index 48fbb27906..c7ff1784ea 100644 --- a/application/Espo/Tools/EntityManager/Rename/Renamer.php +++ b/application/Espo/Tools/EntityManager/Rename/Renamer.php @@ -374,8 +374,7 @@ class Renamer try { $this->entityManager->getSqlExecutor()->execute($sql); - } - catch (Throwable $e) { + } catch (Throwable $e) { $msg = $e->getMessage(); $this->log->error("Entity-rename: Rename relationship column failed: {$msg}."); @@ -608,8 +607,7 @@ class Renamer try { $this->entityManager->getQueryExecutor()->execute($query); - } - catch (Throwable $e) { + } catch (Throwable $e) { $msg = $e->getMessage(); $this->log->error("Entity-rename: Update values in link-parent field {$entityType}.{$field}: {$msg}."); diff --git a/application/Espo/Tools/Export/Jobs/Process.php b/application/Espo/Tools/Export/Jobs/Process.php index 12f3e504e4..d4baf81031 100644 --- a/application/Espo/Tools/Export/Jobs/Process.php +++ b/application/Espo/Tools/Export/Jobs/Process.php @@ -95,8 +95,7 @@ class Process implements Job $result = $export ->setParams($entity->getParams()) ->run(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->setFailed($entity); throw new Error("Export job error: " . $e->getMessage()); diff --git a/application/Espo/Tools/Formula/Service.php b/application/Espo/Tools/Formula/Service.php index 161425d79b..2ed3d6a19c 100644 --- a/application/Espo/Tools/Formula/Service.php +++ b/application/Espo/Tools/Formula/Service.php @@ -61,8 +61,7 @@ class Service $this->parser->parse($expression); $result = SyntaxCheckResult::createSuccess(); - } - catch (SyntaxError $e) { + } catch (SyntaxError $e) { return SyntaxCheckResult::createError($e); } @@ -94,8 +93,7 @@ class Service try { $this->manager->run($expression, $target, $variables); - } - catch (Error $e) { + } catch (Error $e) { $output = $variables->__output ?? null; return RunResult::createError($e, $output); diff --git a/application/Espo/Tools/Import/Import.php b/application/Espo/Tools/Import/Import.php index afaf127c26..0089121055 100644 --- a/application/Espo/Tools/Import/Import.php +++ b/application/Espo/Tools/Import/Import.php @@ -367,8 +367,7 @@ class Import 'isDuplicate' => $rowResult['isDuplicate'] ?? false, ]); } - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error('Import: ' . $e->getMessage()); $import->set('status', ImportEntity::STATUS_FAILED); @@ -516,8 +515,7 @@ class Import try { $this->processRowItem($entity, $attribute, $value, $valueMap); - } - catch (ValidationError $e) { + } catch (ValidationError $e) { $failureList[] = $e->getFailure(); } } @@ -593,8 +591,7 @@ class Import } else { $result['isUpdated'] = true; } - } - catch (Exception $e) { + } catch (Exception $e) { $errorType = null; if ((int) $e->getCode() === 23000 && $e instanceof PDOException) { diff --git a/application/Espo/Tools/Import/Service.php b/application/Espo/Tools/Import/Service.php index 98f4c32e34..0eb6a36b1e 100644 --- a/application/Espo/Tools/Import/Service.php +++ b/application/Espo/Tools/Import/Service.php @@ -234,8 +234,7 @@ class Service try { $createdAtDt = new DateTime($createdAt); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Tools/Layout/Service.php b/application/Espo/Tools/Layout/Service.php index 7c7117274a..20c3dada3a 100644 --- a/application/Espo/Tools/Layout/Service.php +++ b/application/Espo/Tools/Layout/Service.php @@ -103,8 +103,7 @@ class Service if (!$this->acl->checkScope($scope)) { throw new Forbidden("No access to scope $scope."); } - } - catch (NotImplemented) {} + } catch (NotImplemented) {} $data = null; diff --git a/application/Espo/Tools/MassUpdate/Processor.php b/application/Espo/Tools/MassUpdate/Processor.php index 2a6c8fe297..4360e9b1dd 100644 --- a/application/Espo/Tools/MassUpdate/Processor.php +++ b/application/Espo/Tools/MassUpdate/Processor.php @@ -174,8 +174,7 @@ class Processor try { $service->processValidation($entity, $values); - } - catch (Exception) { + } catch (Exception) { return false; } @@ -185,8 +184,7 @@ class Processor try { $this->linkCheck->processFields($entity); - } - catch (Forbidden) { + } catch (Forbidden) { return false; } diff --git a/application/Espo/Tools/Oidc/Service.php b/application/Espo/Tools/Oidc/Service.php index d507a6d363..deb1828609 100644 --- a/application/Espo/Tools/Oidc/Service.php +++ b/application/Espo/Tools/Oidc/Service.php @@ -119,8 +119,7 @@ class Service try { $this->backchannelLogout->logout($rawToken); - } - catch (Invalid $e) { + } catch (Invalid $e) { throw new Forbidden("OIDC logout: Invalid JWT. " . $e->getMessage()); } } diff --git a/application/Espo/Tools/PopupNotification/Service.php b/application/Espo/Tools/PopupNotification/Service.php index 5313a7e574..2554432683 100644 --- a/application/Espo/Tools/PopupNotification/Service.php +++ b/application/Espo/Tools/PopupNotification/Service.php @@ -127,8 +127,7 @@ class Service ); $result[$type] = $itemList; - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Popup notifications: " . $e->getMessage()); } } diff --git a/application/Espo/Tools/Stars/StarService.php b/application/Espo/Tools/Stars/StarService.php index 0396837fae..72ddc66be5 100644 --- a/application/Espo/Tools/Stars/StarService.php +++ b/application/Espo/Tools/Stars/StarService.php @@ -88,8 +88,7 @@ class StarService 'userId' => $user->getId(), 'createdAt' => DateTime::getSystemNowString(), ]); - } - catch (PDOException $e) { + } catch (PDOException $e) { if ((int) $e->getCode() === 23000) { // Duplicate. return; diff --git a/application/Espo/Tools/Stream/Jobs/AutoFollow.php b/application/Espo/Tools/Stream/Jobs/AutoFollow.php index fbd02967b4..88204b2450 100644 --- a/application/Espo/Tools/Stream/Jobs/AutoFollow.php +++ b/application/Espo/Tools/Stream/Jobs/AutoFollow.php @@ -95,8 +95,7 @@ class AutoFollow implements Job try { $hasAccess = $this->aclManager->checkEntityStream($user, $entity); - } - catch (AclNotImplemented $e) { + } catch (AclNotImplemented $e) { $hasAccess = false; } diff --git a/application/Espo/Tools/Stream/RecordService/Helper.php b/application/Espo/Tools/Stream/RecordService/Helper.php index 324932bac9..706e360061 100644 --- a/application/Espo/Tools/Stream/RecordService/Helper.php +++ b/application/Espo/Tools/Stream/RecordService/Helper.php @@ -142,8 +142,7 @@ class Helper $aclManager && $aclManager->checkScope($user, $scope, Table::ACTION_READ) && (!$forParent || $aclManager->checkScope($user, $scope, Table::ACTION_STREAM)); - } - catch (AclNotImplemented) { + } catch (AclNotImplemented) { $hasAccess = false; } @@ -159,8 +158,7 @@ class Helper { try { return $this->userAclManagerProvider->get($user); - } - catch (NotAvailable) { + } catch (NotAvailable) { return null; } } diff --git a/application/Espo/Tools/Stream/Service.php b/application/Espo/Tools/Stream/Service.php index a561c184f0..3a7ce7a6c0 100644 --- a/application/Espo/Tools/Stream/Service.php +++ b/application/Espo/Tools/Stream/Service.php @@ -221,8 +221,7 @@ class Service try { $hasAccess = $this->aclManager->checkEntityStream($user, $entity); - } - catch (AclNotImplemented) { + } catch (AclNotImplemented) { $hasAccess = false; } @@ -1103,8 +1102,7 @@ class Service { try { return $this->userAclManagerProvider->get($user); - } - catch (NotAvailable) { + } catch (NotAvailable) { return null; } } diff --git a/application/Espo/Tools/Stream/UserRecordService.php b/application/Espo/Tools/Stream/UserRecordService.php index 36d9b40f51..96df085d23 100644 --- a/application/Espo/Tools/Stream/UserRecordService.php +++ b/application/Espo/Tools/Stream/UserRecordService.php @@ -204,8 +204,7 @@ class UserRecordService { try { return $this->userAclManagerProvider->get($user); - } - catch (Acl\Exceptions\NotAvailable) { + } catch (Acl\Exceptions\NotAvailable) { return null; } } diff --git a/application/Espo/Tools/UserSecurity/Password/RecoveryService.php b/application/Espo/Tools/UserSecurity/Password/RecoveryService.php index 0b627f7f14..c85aa44d14 100644 --- a/application/Espo/Tools/UserSecurity/Password/RecoveryService.php +++ b/application/Espo/Tools/UserSecurity/Password/RecoveryService.php @@ -239,8 +239,7 @@ class RecoveryService try { $this->send($request->getRequestId(), $emailAddress, $user); - } - catch (SendingError $e) { + } catch (SendingError $e) { $message = "Email sending error. " . $e->getMessage(); $this->log->error($message); @@ -323,8 +322,7 @@ class RecoveryService try { $this->send($entity->getRequestId(), $emailAddress, $user); - } - catch (SendingError $e) { + } catch (SendingError $e) { $this->log->error("Email sending error. " . $e->getMessage()); throw new Error("Email sending error."); diff --git a/application/Espo/Tools/UserSecurity/Password/Service.php b/application/Espo/Tools/UserSecurity/Password/Service.php index 4881f1e193..ca775d79e6 100644 --- a/application/Espo/Tools/UserSecurity/Password/Service.php +++ b/application/Espo/Tools/UserSecurity/Password/Service.php @@ -284,8 +284,7 @@ class Service try { $this->sender->sendPassword($user, $password); - } - catch (SendingError) { + } catch (SendingError) { throw new Error("Email sending error."); } diff --git a/application/Espo/Tools/UserSecurity/Service.php b/application/Espo/Tools/UserSecurity/Service.php index c889a84905..86181f2950 100644 --- a/application/Espo/Tools/UserSecurity/Service.php +++ b/application/Espo/Tools/UserSecurity/Service.php @@ -155,8 +155,7 @@ class Service $clientData = $this->twoFactorUserSetupFactory ->create($auth2FAMethod) ->getData($user); - } - catch (NotConfigured $e) { + } catch (NotConfigured $e) { $this->log->error($e->getMessage()); throw Forbidden::createWithBody( diff --git a/application/Espo/Tools/WorkingTime/GlobalCalendar.php b/application/Espo/Tools/WorkingTime/GlobalCalendar.php index fa42139bf8..e61da16539 100644 --- a/application/Espo/Tools/WorkingTime/GlobalCalendar.php +++ b/application/Espo/Tools/WorkingTime/GlobalCalendar.php @@ -93,8 +93,7 @@ class GlobalCalendar implements Calendar try { return new DateTimeZone($this->config->get('timeZone')); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } } diff --git a/application/Espo/Tools/WorkingTime/SpecificCalendar.php b/application/Espo/Tools/WorkingTime/SpecificCalendar.php index 6d2a97344c..5743a6d99e 100644 --- a/application/Espo/Tools/WorkingTime/SpecificCalendar.php +++ b/application/Espo/Tools/WorkingTime/SpecificCalendar.php @@ -64,8 +64,7 @@ class SpecificCalendar implements Calendar ) { try { $this->timezone = new DateTimeZone($config->get('timeZone')); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Tools/WorkingTime/TeamCalendar.php b/application/Espo/Tools/WorkingTime/TeamCalendar.php index f666934290..c6c7c97c4e 100644 --- a/application/Espo/Tools/WorkingTime/TeamCalendar.php +++ b/application/Espo/Tools/WorkingTime/TeamCalendar.php @@ -64,8 +64,7 @@ class TeamCalendar implements Calendar ) { try { $this->timezone = new DateTimeZone($config->get('timeZone')); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Tools/WorkingTime/UserCalendar.php b/application/Espo/Tools/WorkingTime/UserCalendar.php index 6ef30157f4..9f607984dd 100644 --- a/application/Espo/Tools/WorkingTime/UserCalendar.php +++ b/application/Espo/Tools/WorkingTime/UserCalendar.php @@ -63,8 +63,7 @@ class UserCalendar implements Calendar ) { try { $this->timezone = new DateTimeZone($config->get('timeZone')); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/install/core/Installer.php b/install/core/Installer.php index 335e42d0a6..af215e5aec 100644 --- a/install/core/Installer.php +++ b/install/core/Installer.php @@ -253,8 +253,7 @@ class Installer } $this->language = $language; - } - catch (Throwable $e) { + } catch (Throwable $e) { echo "Error: " . $e->getMessage(); $GLOBALS['log']->error($e->getMessage()); @@ -328,8 +327,7 @@ class Installer try { $this->databaseHelper->createPDO($params); - } - catch (Exception $e) { + } catch (Exception $e) { if (!$createDatabase) { throw $e; } @@ -431,8 +429,7 @@ class Installer { try { $this->app->getContainer()->getByClass(DataManager::class)->rebuild(); - } - catch (Exception) { + } catch (Exception) { $this->auth(); $this->app->getContainer()->getByClass(DataManager::class)->rebuild(); diff --git a/install/core/actions/settingsTest.php b/install/core/actions/settingsTest.php index 46ae09d72b..3936b7de21 100644 --- a/install/core/actions/settingsTest.php +++ b/install/core/actions/settingsTest.php @@ -95,8 +95,7 @@ if ( try { $installer->checkDatabaseConnection($databaseParams, true); - } - catch (\Exception $e) { + } catch (\Exception $e) { $isConnected = false; $result['success'] = false; $result['errors']['dbConnect']['errorCode'] = $e->getCode(); diff --git a/tests/integration/Espo/Record/FieldValidationTest.php b/tests/integration/Espo/Record/FieldValidationTest.php index 57eb1fdb5d..459ade79c6 100644 --- a/tests/integration/Espo/Record/FieldValidationTest.php +++ b/tests/integration/Espo/Record/FieldValidationTest.php @@ -511,8 +511,7 @@ class FieldValidationTest extends BaseTestCase ], ], ], CreateParams::create()); - } - catch (BadRequest) { + } catch (BadRequest) { $thrown = true; } diff --git a/tests/integration/Espo/Stream/AuditTest.php b/tests/integration/Espo/Stream/AuditTest.php index 7d1261becb..f741b9346a 100644 --- a/tests/integration/Espo/Stream/AuditTest.php +++ b/tests/integration/Espo/Stream/AuditTest.php @@ -133,8 +133,7 @@ class AuditTest extends BaseTestCase $service = $this->getInjectableFactory()->create(RecordService::class); /** @noinspection PhpUnhandledExceptionInspection */ $service->findUpdates(KnowledgeBaseArticle::ENTITY_TYPE, $article->getId(), $searchParams); - } - catch (Forbidden) { + } catch (Forbidden) { $isThrown = true; } @@ -149,8 +148,7 @@ class AuditTest extends BaseTestCase $service = $this->getInjectableFactory()->create(RecordService::class); /** @noinspection PhpUnhandledExceptionInspection */ $service->findUpdates(KnowledgeBaseArticle::ENTITY_TYPE, $article->getId(), $searchParams); - } - catch (Forbidden) { + } catch (Forbidden) { $isThrown = true; } diff --git a/tests/integration/Espo/User/AclTest.php b/tests/integration/Espo/User/AclTest.php index daf762f6b0..66be822390 100644 --- a/tests/integration/Espo/User/AclTest.php +++ b/tests/integration/Espo/User/AclTest.php @@ -280,8 +280,7 @@ class AclTest extends \tests\integration\Core\BaseTestCase try { $processor->process('User', 'update', $request, $response); - } - catch (Exception $e) {}; + } catch (Exception $e) {}; } protected function prepareTestUser()