diff --git a/application/Espo/Classes/Acl/Note/AccessChecker.php b/application/Espo/Classes/Acl/Note/AccessChecker.php index ad0177a3db..15eb723d06 100644 --- a/application/Espo/Classes/Acl/Note/AccessChecker.php +++ b/application/Espo/Classes/Acl/Note/AccessChecker.php @@ -184,8 +184,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($dt->format('U') > (new DateTime($createdAt))->format('U')) { return false; } - } - catch (Exception $e) { + } catch (Exception $e) { return false; } @@ -226,8 +225,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($dt->format('U') > (new DateTime($createdAt))->format('U')) { return false; } - } - catch (Exception $e) { + } catch (Exception $e) { return false; } diff --git a/application/Espo/Classes/AclPortal/Note/AccessChecker.php b/application/Espo/Classes/AclPortal/Note/AccessChecker.php index b0d71ef94d..44c62c9aa0 100644 --- a/application/Espo/Classes/AclPortal/Note/AccessChecker.php +++ b/application/Espo/Classes/AclPortal/Note/AccessChecker.php @@ -154,8 +154,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($dt->format('U') > (new DateTime($createdAt))->format('U')) { return false; } - } - catch (Exception $e) { + } catch (Exception $e) { return false; } @@ -192,8 +191,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($dt->format('U') > (new DateTime($createdAt))->format('U')) { return false; } - } - catch (Exception $e) { + } catch (Exception $e) { return false; } diff --git a/application/Espo/Classes/ConsoleCommands/Import.php b/application/Espo/Classes/ConsoleCommands/Import.php index 3b213f2da5..f242db45d8 100644 --- a/application/Espo/Classes/ConsoleCommands/Import.php +++ b/application/Espo/Classes/ConsoleCommands/Import.php @@ -75,8 +75,7 @@ class Import implements Command $countUpdated = $result->getCountUpdated(); $countError = $result->getCountError(); $countDuplicate = $result->getCountDuplicate(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine("Error occurred: " . $e->getMessage()); return; @@ -97,8 +96,7 @@ class Import implements Command try { $this->service->revert($id); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine("Error occurred: " . $e->getMessage()); return; @@ -114,8 +112,7 @@ class Import implements Command try { $result = $this->service->importById($id, true, $forceResume); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine("Error occurred: " . $e->getMessage()); return; diff --git a/application/Espo/Classes/ConsoleCommands/RebuildCategoryPaths.php b/application/Espo/Classes/ConsoleCommands/RebuildCategoryPaths.php index 61331124ee..bd0f0cca95 100644 --- a/application/Espo/Classes/ConsoleCommands/RebuildCategoryPaths.php +++ b/application/Espo/Classes/ConsoleCommands/RebuildCategoryPaths.php @@ -57,8 +57,7 @@ class RebuildCategoryPaths implements Command try { $this->rebuildPaths->run($entityType); - } - catch (Exception $e) { + } catch (Exception $e) { $io->setExitStatus(1); $io->writeLine("Error: " . $e->getMessage()); diff --git a/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php b/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php index 0920ff4719..1655ac1747 100644 --- a/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php +++ b/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php @@ -104,8 +104,7 @@ class IcsDataLoader implements Loader $valueMap->dateStartDate = $espoEvent->getDateStart(); $valueMap->dateEndDate = $espoEvent->getDateEnd(); } - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->warning("Error while converting ICS event '" . $entity->getId() . "': " . $e->getMessage()); return; diff --git a/application/Espo/Classes/FieldProcessing/User/LastAccessLoader.php b/application/Espo/Classes/FieldProcessing/User/LastAccessLoader.php index eda4cffbd3..4967260209 100644 --- a/application/Espo/Classes/FieldProcessing/User/LastAccessLoader.php +++ b/application/Espo/Classes/FieldProcessing/User/LastAccessLoader.php @@ -82,8 +82,7 @@ class LastAccessLoader implements Loader if ($lastAccess) { try { $dt = new DateTime($lastAccess); - } - catch (Exception) {} + } catch (Exception) {} } $where = [ diff --git a/application/Espo/Classes/FieldSanitizers/Date.php b/application/Espo/Classes/FieldSanitizers/Date.php index 22f5a882ca..e0c4267326 100644 --- a/application/Espo/Classes/FieldSanitizers/Date.php +++ b/application/Espo/Classes/FieldSanitizers/Date.php @@ -54,8 +54,7 @@ class Date implements Sanitizer DateValue::fromString($value); return; - } - catch (Exception) {} + } catch (Exception) {} $dateTime = DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, $value); diff --git a/application/Espo/Classes/FieldSanitizers/Datetime.php b/application/Espo/Classes/FieldSanitizers/Datetime.php index d979628119..b3ce9f7a47 100644 --- a/application/Espo/Classes/FieldSanitizers/Datetime.php +++ b/application/Espo/Classes/FieldSanitizers/Datetime.php @@ -55,8 +55,7 @@ class Datetime implements Sanitizer DateTimeValue::fromString($value); return; - } - catch (Exception) {} + } catch (Exception) {} $dateTime = DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, $value); diff --git a/application/Espo/Classes/FieldSanitizers/DatetimeOptionalDate.php b/application/Espo/Classes/FieldSanitizers/DatetimeOptionalDate.php index 96fbeae4a3..c42ad5561a 100644 --- a/application/Espo/Classes/FieldSanitizers/DatetimeOptionalDate.php +++ b/application/Espo/Classes/FieldSanitizers/DatetimeOptionalDate.php @@ -56,8 +56,7 @@ class DatetimeOptionalDate implements Sanitizer Date::fromString($value); return; - } - catch (Exception) {} + } catch (Exception) {} $dateTime = DateTimeImmutable::createFromFormat(DateTimeInterface::ATOM, $value); diff --git a/application/Espo/Classes/FieldValidators/DateType.php b/application/Espo/Classes/FieldValidators/DateType.php index 6e003feea5..47c9b28b9a 100644 --- a/application/Espo/Classes/FieldValidators/DateType.php +++ b/application/Espo/Classes/FieldValidators/DateType.php @@ -57,8 +57,7 @@ class DateType try { Date::fromString($value); - } - catch (Exception $e) { + } catch (Exception $e) { return false; } diff --git a/application/Espo/Classes/FieldValidators/DatetimeOptionalType.php b/application/Espo/Classes/FieldValidators/DatetimeOptionalType.php index ce9798652f..b8e679ebf3 100644 --- a/application/Espo/Classes/FieldValidators/DatetimeOptionalType.php +++ b/application/Espo/Classes/FieldValidators/DatetimeOptionalType.php @@ -62,8 +62,7 @@ class DatetimeOptionalType extends DatetimeType if ($dateValue !== null) { try { Date::fromString($dateValue); - } - catch (Exception $e) { + } catch (Exception $e) { return false; } } @@ -74,8 +73,7 @@ class DatetimeOptionalType extends DatetimeType if ($value !== null) { try { DateTime::fromString($value); - } - catch (Exception $e) { + } catch (Exception $e) { return false; } } diff --git a/application/Espo/Classes/FieldValidators/DatetimeType.php b/application/Espo/Classes/FieldValidators/DatetimeType.php index 225b214373..5d04c1ffcb 100644 --- a/application/Espo/Classes/FieldValidators/DatetimeType.php +++ b/application/Espo/Classes/FieldValidators/DatetimeType.php @@ -47,8 +47,7 @@ class DatetimeType extends DateType try { DateTime::fromString($value); - } - catch (Exception $e) { + } catch (Exception $e) { return false; } diff --git a/application/Espo/Classes/FieldValidators/PhoneType.php b/application/Espo/Classes/FieldValidators/PhoneType.php index c925797494..e60a3f730a 100644 --- a/application/Espo/Classes/FieldValidators/PhoneType.php +++ b/application/Espo/Classes/FieldValidators/PhoneType.php @@ -222,8 +222,7 @@ class PhoneType try { $numberObj = PhoneNumber::parse($number); - } - catch (PhoneNumberParseException) { + } catch (PhoneNumberParseException) { return false; } diff --git a/application/Espo/Classes/FieldValidators/ScheduledJob/Scheduling/Valid.php b/application/Espo/Classes/FieldValidators/ScheduledJob/Scheduling/Valid.php index c4abbfbfa7..cf82ac3070 100644 --- a/application/Espo/Classes/FieldValidators/ScheduledJob/Scheduling/Valid.php +++ b/application/Espo/Classes/FieldValidators/ScheduledJob/Scheduling/Valid.php @@ -52,8 +52,7 @@ class Valid implements Validator try { new CronExpression($scheduling); - } - catch (Exception) { + } catch (Exception) { return Failure::create(); } diff --git a/application/Espo/Classes/Jobs/CheckEmailAccounts.php b/application/Espo/Classes/Jobs/CheckEmailAccounts.php index 23119c65bd..d898615d4c 100644 --- a/application/Espo/Classes/Jobs/CheckEmailAccounts.php +++ b/application/Espo/Classes/Jobs/CheckEmailAccounts.php @@ -51,8 +51,7 @@ class CheckEmailAccounts implements Job try { $this->service->fetch($targetId); - } - catch (Throwable $e) { + } catch (Throwable $e) { throw new RuntimeException("CheckInboundEmails job failed, $targetId; {$e->getMessage()}", 0, $e); } } diff --git a/application/Espo/Classes/Jobs/CheckInboundEmails.php b/application/Espo/Classes/Jobs/CheckInboundEmails.php index 2d93735d10..0003ec380c 100644 --- a/application/Espo/Classes/Jobs/CheckInboundEmails.php +++ b/application/Espo/Classes/Jobs/CheckInboundEmails.php @@ -51,8 +51,7 @@ class CheckInboundEmails implements Job try { $this->service->fetch($targetId); - } - catch (Throwable $e) { + } catch (Throwable $e) { throw new RuntimeException("CheckInboundEmails job failed, $targetId; {$e->getMessage()}", 0, $e); } } diff --git a/application/Espo/Classes/Jobs/Cleanup.php b/application/Espo/Classes/Jobs/Cleanup.php index bc40cc5828..b4bb545945 100644 --- a/application/Espo/Classes/Jobs/Cleanup.php +++ b/application/Espo/Classes/Jobs/Cleanup.php @@ -135,8 +135,7 @@ class Cleanup implements JobDataLess $obj = $injectableFactory->create($className); $obj->process(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Cleanup: {$name}: " . $e->getMessage()); } } @@ -651,8 +650,7 @@ class Cleanup implements JobDataLess ->build(); $this->entityManager->getQueryExecutor()->execute($delete); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error("Cleanup: " . $e->getMessage()); } } @@ -793,8 +791,7 @@ class Cleanup implements JobDataLess if (method_exists($service, 'cleanup')) { try { $service->cleanup($entity->getId()); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Cleanup job: Cleanup scope {$scope}: " . $e->getMessage()); } } diff --git a/application/Espo/Classes/MassAction/Email/MoveToFolder.php b/application/Espo/Classes/MassAction/Email/MoveToFolder.php index 963a281afa..7b960e8c8b 100644 --- a/application/Espo/Classes/MassAction/Email/MoveToFolder.php +++ b/application/Espo/Classes/MassAction/Email/MoveToFolder.php @@ -99,8 +99,7 @@ class MoveToFolder implements MassAction try { $query = $this->queryBuilder->build($params); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -116,8 +115,7 @@ class MoveToFolder implements MassAction foreach ($collection as $email) { try { $this->service->moveToFolder($email->getId(), $folderId, $this->user->getId()); - } - catch (Exception) { + } catch (Exception) { continue; } diff --git a/application/Espo/Classes/Select/Event/PrimaryFilters/Todays.php b/application/Espo/Classes/Select/Event/PrimaryFilters/Todays.php index da70a649c4..e46f90b36a 100644 --- a/application/Espo/Classes/Select/Event/PrimaryFilters/Todays.php +++ b/application/Espo/Classes/Select/Event/PrimaryFilters/Todays.php @@ -60,8 +60,7 @@ class Todays implements Filter $whereItem = $this->converterFactory ->create($this->entityType, $this->user) ->convert($queryBuilder, $item); - } - catch (Error $e) { + } catch (Error $e) { throw new LogicException($e->getMessage()); } diff --git a/application/Espo/Classes/Select/Template/AccessControlFilters/Mandatory.php b/application/Espo/Classes/Select/Template/AccessControlFilters/Mandatory.php index 34855d8974..11d93c4ab1 100644 --- a/application/Espo/Classes/Select/Template/AccessControlFilters/Mandatory.php +++ b/application/Espo/Classes/Select/Template/AccessControlFilters/Mandatory.php @@ -58,8 +58,7 @@ class Mandatory implements Filter if (!$this->aclManager->checkScope($this->user, $entityType)) { $forbiddenEntityTypeList[] = $entityType; } - } - catch (NotImplemented $e) {} + } catch (NotImplemented $e) {} } if (empty($forbiddenEntityTypeList)) { diff --git a/application/Espo/Core/Acl/DefaultAccessChecker.php b/application/Espo/Core/Acl/DefaultAccessChecker.php index fb5d3b5b20..17a1bf83f7 100644 --- a/application/Espo/Core/Acl/DefaultAccessChecker.php +++ b/application/Espo/Core/Acl/DefaultAccessChecker.php @@ -215,8 +215,7 @@ class DefaultAccessChecker implements { try { $dt = new DateTime($value); - } - catch (Exception) { + } catch (Exception) { return false; } diff --git a/application/Espo/Core/AclManager.php b/application/Espo/Core/AclManager.php index 0bc2a6b676..5f82f80e22 100644 --- a/application/Espo/Core/AclManager.php +++ b/application/Espo/Core/AclManager.php @@ -279,8 +279,7 @@ class AclManager { try { return $this->check($user, $subject, $action); - } - catch (NotImplemented) { + } catch (NotImplemented) { return false; } } diff --git a/application/Espo/Core/Api/Auth.php b/application/Espo/Core/Api/Auth.php index f25621a456..9f5ad5d6f5 100644 --- a/application/Espo/Core/Api/Auth.php +++ b/application/Espo/Core/Api/Auth.php @@ -130,8 +130,7 @@ class Auth try { $result = $this->authentication->login($data, $request, $response); - } - catch (Exception $e) { + } catch (Exception $e) { $this->handleException($response, $e); return AuthResult::createNotResolved(); @@ -155,8 +154,7 @@ class Auth try { $result = $this->authentication->login($data, $request, $response); - } - catch (Exception $e) { + } catch (Exception $e) { $this->handleException($response, $e); return AuthResult::createNotResolved(); diff --git a/application/Espo/Core/Api/RouteProcessor.php b/application/Espo/Core/Api/RouteProcessor.php index 895e64fbe9..eacbbb1bfd 100644 --- a/application/Espo/Core/Api/RouteProcessor.php +++ b/application/Espo/Core/Api/RouteProcessor.php @@ -81,8 +81,7 @@ class RouteProcessor $requestWrapped, $responseWrapped ); - } - catch (Exception $exception) { + } catch (Exception $exception) { $this->handleException( $exception, $requestWrapped, @@ -242,8 +241,7 @@ class RouteProcessor try { $this->errorOutput->process($request, $response, $exception, $route); - } - catch (Throwable $exceptionAnother) { + } catch (Throwable $exceptionAnother) { $this->log->error($exceptionAnother->getMessage()); $response->setStatus(500); diff --git a/application/Espo/Core/Application.php b/application/Espo/Core/Application.php index e0ddd31098..1f05623b5f 100644 --- a/application/Espo/Core/Application.php +++ b/application/Espo/Core/Application.php @@ -76,8 +76,7 @@ class Application try { $runnerRunner->run($className, $params); - } - catch (RunnerException $e) { + } catch (RunnerException $e) { die($e->getMessage()); } } diff --git a/application/Espo/Core/ApplicationRunners/Command.php b/application/Espo/Core/ApplicationRunners/Command.php index c83f132c6a..8d3215c28d 100644 --- a/application/Espo/Core/ApplicationRunners/Command.php +++ b/application/Espo/Core/ApplicationRunners/Command.php @@ -48,8 +48,7 @@ class Command implements Runner { try { $exitStatus = $this->commandManager->run($_SERVER['argv']); - } - catch (Exception $e) { + } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; exit(1); diff --git a/application/Espo/Core/ApplicationRunners/PortalClient.php b/application/Espo/Core/ApplicationRunners/PortalClient.php index 4915248acd..69958686f3 100644 --- a/application/Espo/Core/ApplicationRunners/PortalClient.php +++ b/application/Espo/Core/ApplicationRunners/PortalClient.php @@ -87,8 +87,7 @@ class PortalClient implements RunnerParameterized } $application = new PortalApplication($id); - } - catch (Exception $e) { + } catch (Exception $e) { $this->processError($requestWrapped, $responseWrapped, $e); return; diff --git a/application/Espo/Core/ApplicationRunners/Preload.php b/application/Espo/Core/ApplicationRunners/Preload.php index a92ba21f54..61f2404eef 100644 --- a/application/Espo/Core/ApplicationRunners/Preload.php +++ b/application/Espo/Core/ApplicationRunners/Preload.php @@ -52,8 +52,7 @@ class Preload implements Runner try { $preload->process(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->processException($e); throw $e; diff --git a/application/Espo/Core/ApplicationRunners/Rebuild.php b/application/Espo/Core/ApplicationRunners/Rebuild.php index b61681f836..855a896339 100644 --- a/application/Espo/Core/ApplicationRunners/Rebuild.php +++ b/application/Espo/Core/ApplicationRunners/Rebuild.php @@ -48,8 +48,7 @@ class Rebuild implements Runner { try { $this->dataManager->rebuild(); - } - catch (Exception $e) { + } catch (Exception $e) { echo "Error: " . $e->getMessage() . "\n"; $this->log->error('Rebuild: ' . $e->getMessage(), [ diff --git a/application/Espo/Core/Authentication/Hook/Hooks/FailedAttemptsLimit.php b/application/Espo/Core/Authentication/Hook/Hooks/FailedAttemptsLimit.php index c6b858f3e5..faf9c6147b 100644 --- a/application/Espo/Core/Authentication/Hook/Hooks/FailedAttemptsLimit.php +++ b/application/Espo/Core/Authentication/Hook/Hooks/FailedAttemptsLimit.php @@ -103,8 +103,7 @@ class FailedAttemptsLimit implements BeforeLogin try { $requestTimeFrom = (new DateTime('@' . $requestTime))->modify('-' . $failedAttemptsPeriod); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Authentication/Hook/Hooks/FailedCodeAttemptsLimit.php b/application/Espo/Core/Authentication/Hook/Hooks/FailedCodeAttemptsLimit.php index c51f43a5c8..68d6935ab1 100644 --- a/application/Espo/Core/Authentication/Hook/Hooks/FailedCodeAttemptsLimit.php +++ b/application/Espo/Core/Authentication/Hook/Hooks/FailedCodeAttemptsLimit.php @@ -108,8 +108,7 @@ class FailedCodeAttemptsLimit implements BeforeLogin try { $requestTimeFrom = (new DateTime('@' . $requestTime))->modify('-' . $failedAttemptsPeriod); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Authentication/Jwt/Token/Header.php b/application/Espo/Core/Authentication/Jwt/Token/Header.php index 4e9fce7803..7e7dcd7db2 100644 --- a/application/Espo/Core/Authentication/Jwt/Token/Header.php +++ b/application/Espo/Core/Authentication/Jwt/Token/Header.php @@ -71,8 +71,7 @@ class Header try { $parsed = Json::decode($raw); - } - catch (JsonException) {} + } catch (JsonException) {} if (!$parsed instanceof stdClass) { throw new RuntimeException(); diff --git a/application/Espo/Core/Authentication/Jwt/Token/Payload.php b/application/Espo/Core/Authentication/Jwt/Token/Payload.php index 8aeb08ed9d..59b94d2680 100644 --- a/application/Espo/Core/Authentication/Jwt/Token/Payload.php +++ b/application/Espo/Core/Authentication/Jwt/Token/Payload.php @@ -143,8 +143,7 @@ class Payload try { $parsed = Json::decode($raw); - } - catch (JsonException) {} + } catch (JsonException) {} if (!$parsed instanceof stdClass) { throw new RuntimeException(); diff --git a/application/Espo/Core/Authentication/Ldap/LdapLogin.php b/application/Espo/Core/Authentication/Ldap/LdapLogin.php index 0ba4017b7b..25ce35e743 100644 --- a/application/Espo/Core/Authentication/Ldap/LdapLogin.php +++ b/application/Espo/Core/Authentication/Ldap/LdapLogin.php @@ -153,8 +153,7 @@ class LdapLogin implements Login /* Login LDAP system user (ldapUsername, ldapPassword) */ try { $ldapClient->bind(); - } - catch (Exception $e) { + } catch (Exception $e) { $options = $this->utils->getLdapClientOptions(); $this->log->error("LDAP: Could not connect to LDAP server host. {message}", [ @@ -182,8 +181,7 @@ class LdapLogin implements Login try { $userDn = $this->findLdapUserDnByUsername($username); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error("Error while finding DN for '{username}'. {message}", [ 'username' => $username, 'message' => $e->getMessage(), @@ -213,8 +211,7 @@ class LdapLogin implements Login try { $ldapClient->bind($userDn, $password); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error("LDAP: Authentication failed for '{username}'. {message}", [ 'username' => $username, 'message' => $e->getMessage(), @@ -266,8 +263,7 @@ class LdapLogin implements Login try { $this->client = $this->clientFactory->create($options); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error("LDAP error. {message}", ['message' => $e->getMessage()]); } } diff --git a/application/Espo/Core/Authentication/Oidc/KeysProvider.php b/application/Espo/Core/Authentication/Oidc/KeysProvider.php index d67a238c2c..f267ce58e1 100644 --- a/application/Espo/Core/Authentication/Oidc/KeysProvider.php +++ b/application/Espo/Core/Authentication/Oidc/KeysProvider.php @@ -66,8 +66,7 @@ class KeysProvider foreach ($rawKeys as $raw) { try { $list[] = $this->factory->create($raw); - } - catch (UnsupportedKey) { + } catch (UnsupportedKey) { $this->log->debug("OIDC: Unsupported key " . print_r($raw, true)); } } @@ -134,8 +133,7 @@ class KeysProvider try { $parsedResponse = Json::decode($response); - } - catch (JsonException) {} + } catch (JsonException) {} if (!$parsedResponse instanceof stdClass || !isset($parsedResponse->keys)) { throw new RuntimeException("OIDC: JWKS bad response."); diff --git a/application/Espo/Core/Authentication/Oidc/Login.php b/application/Espo/Core/Authentication/Oidc/Login.php index fdf2e9c1c8..190499f959 100644 --- a/application/Espo/Core/Authentication/Oidc/Login.php +++ b/application/Espo/Core/Authentication/Oidc/Login.php @@ -111,8 +111,7 @@ class Login implements LoginInterface try { $token = Token::create($rawToken); - } - catch (RuntimeException $e) { + } catch (RuntimeException $e) { $message = self::composeLogMessage('JWT parsing error.'); if ($e->getMessage()) { @@ -129,8 +128,7 @@ class Login implements LoginInterface try { $this->validateToken($token); - } - catch (Invalid $e) { + } catch (Invalid $e) { $this->log->error("OIDC: " . $e->getMessage()); return Result::fail(FailReason::DENIED); @@ -259,8 +257,7 @@ class Login implements LoginInterface try { $parsedResponse = Json::decode($response); - } - catch (JsonException) {} + } catch (JsonException) {} if (!$parsedResponse instanceof stdClass) { $this->log->error(self::composeLogMessage('Bad token response.', $status, $response)); diff --git a/application/Espo/Core/Authentication/TwoFactor/Email/EmailLogin.php b/application/Espo/Core/Authentication/TwoFactor/Email/EmailLogin.php index 521a05faad..148a3f4a53 100644 --- a/application/Espo/Core/Authentication/TwoFactor/Email/EmailLogin.php +++ b/application/Espo/Core/Authentication/TwoFactor/Email/EmailLogin.php @@ -68,8 +68,7 @@ class EmailLogin implements Login if (!$code) { try { $this->util->sendCode($user); - } - catch (Forbidden|SendingError $e) { + } catch (Forbidden|SendingError $e) { $this->log->error("Could not send 2FA code for user {$user->getUserName()}. " . $e->getMessage()); return Result::fail(FailReason::ERROR); diff --git a/application/Espo/Core/Authentication/TwoFactor/Sms/SmsLogin.php b/application/Espo/Core/Authentication/TwoFactor/Sms/SmsLogin.php index fd10dcbe79..663457c68e 100644 --- a/application/Espo/Core/Authentication/TwoFactor/Sms/SmsLogin.php +++ b/application/Espo/Core/Authentication/TwoFactor/Sms/SmsLogin.php @@ -73,8 +73,7 @@ class SmsLogin implements Login try { $this->util->sendCode($user); - } - catch (Forbidden $e) { + } catch (Forbidden $e) { $this->log->error("Could not send 2FA code for user {$user->getUserName()}. " . $e->getMessage()); return Result::fail(FailReason::ERROR); diff --git a/application/Espo/Core/Authentication/TwoFactor/Totp/Util.php b/application/Espo/Core/Authentication/TwoFactor/Totp/Util.php index 1cfbf1eef2..b634fab835 100644 --- a/application/Espo/Core/Authentication/TwoFactor/Totp/Util.php +++ b/application/Espo/Core/Authentication/TwoFactor/Totp/Util.php @@ -48,8 +48,7 @@ class Util try { return $impl->createSecret(); - } - catch (TwoFactorAuthException $e) { + } catch (TwoFactorAuthException $e) { throw new RuntimeException($e->getMessage()); } } diff --git a/application/Espo/Core/Console/Commands/Extension.php b/application/Espo/Core/Console/Commands/Extension.php index 191d40043b..77ff8636a3 100644 --- a/application/Espo/Core/Console/Commands/Extension.php +++ b/application/Espo/Core/Console/Commands/Extension.php @@ -124,8 +124,7 @@ class Extension implements Command try { $id = $manager->upload($fileDataEncoded); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine($e->getMessage()); $io->setExitStatus(1); @@ -148,8 +147,7 @@ class Extension implements Command try { $manager->install(['id' => $id]); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine(""); $io->writeLine($e->getMessage()); $io->setExitStatus(1); @@ -216,8 +214,7 @@ class Extension implements Command try { $manager->uninstall(['id' => $id]); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine(""); $io->writeLine($e->getMessage()); $io->setExitStatus(1); @@ -236,8 +233,7 @@ class Extension implements Command try { $manager->delete(['id' => $id]); - } - catch (Throwable $e) { + } catch (Throwable $e) { $io->writeLine($e->getMessage()); $io->writeLine("Extension '$name' is uninstalled but could not be deleted."); diff --git a/application/Espo/Core/Console/Commands/RunJob.php b/application/Espo/Core/Console/Commands/RunJob.php index ddff528a2e..d6b73b1f6c 100644 --- a/application/Espo/Core/Console/Commands/RunJob.php +++ b/application/Espo/Core/Console/Commands/RunJob.php @@ -93,8 +93,7 @@ class RunJob implements Command try { $this->jobManager->runJob($job); - } - catch (Throwable $e) { + } catch (Throwable $e) { $message = "Error: Job '$jobName' failed to execute."; if ($e->getMessage()) { diff --git a/application/Espo/Core/Console/Commands/Upgrade.php b/application/Espo/Core/Console/Commands/Upgrade.php index 2c4c6e9990..d46dc642af 100644 --- a/application/Espo/Core/Console/Commands/Upgrade.php +++ b/application/Espo/Core/Console/Commands/Upgrade.php @@ -161,8 +161,7 @@ class Upgrade implements Command try { $this->runUpgradeProcess($upgradeId, $upgradeParams); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->displayStep('revert'); $errorMessage = $e->getMessage(); } @@ -294,8 +293,7 @@ class Upgrade implements Command $fileData = 'data:application/zip;base64,' . base64_encode($fileData); $upgradeId = $this->getUpgradeManager()->upload($fileData); - } - catch (Exception $e) { + } catch (Exception $e) { die("Error: " . $e->getMessage() . "\n"); } @@ -341,12 +339,10 @@ class Upgrade implements Command $upgradeManager->runInstallStep($stepName, ['id' => $upgradeId]); } - } - catch (Throwable $e) { + } catch (Throwable $e) { try { $this->log->error('Upgrade Error: ' . $e->getMessage()); - } - catch (Throwable) {} + } catch (Throwable) {} throw new Error($e->getMessage()); } @@ -372,8 +368,7 @@ class Upgrade implements Command if ($shellResult !== 'true') { try { $this->log->error('Upgrade Error: ' . $shellResult); - } - catch (Throwable) {} + } catch (Throwable) {} throw new Error($shellResult ?: 'Unknown error on shell_exec.'); } @@ -449,8 +444,7 @@ class Upgrade implements Command try { $data = json_decode($result); /** @phpstan-ignore-line */ - } - catch (Exception) { /** @phpstan-ignore-line */ + } catch (Exception) { /** @phpstan-ignore-line */ echo "Could not parse info about next version.\n"; return null; diff --git a/application/Espo/Core/Console/Commands/UpgradeStep.php b/application/Espo/Core/Console/Commands/UpgradeStep.php index a073c92be8..23341ae66c 100644 --- a/application/Espo/Core/Console/Commands/UpgradeStep.php +++ b/application/Espo/Core/Console/Commands/UpgradeStep.php @@ -81,8 +81,7 @@ class UpgradeStep implements Command try { $upgradeManager->runInstallStep($stepName, $params); - } - catch (Exception $e) { + } catch (Exception $e) { die("Error: " . $e->getMessage()); } } diff --git a/application/Espo/Core/Container.php b/application/Espo/Core/Container.php index 35e6d94ed5..96481f43da 100644 --- a/application/Espo/Core/Container.php +++ b/application/Espo/Core/Container.php @@ -177,8 +177,7 @@ class Container implements ContainerInterface if ($this->isSet($id)) { try { $object = $this->get($id); - } - catch (NotFoundExceptionInterface) { + } catch (NotFoundExceptionInterface) { throw new LogicException(); } diff --git a/application/Espo/Core/DataManager.php b/application/Espo/Core/DataManager.php index 705d673517..4494bd4ed2 100644 --- a/application/Espo/Core/DataManager.php +++ b/application/Espo/Core/DataManager.php @@ -122,8 +122,7 @@ class DataManager try { $result = $schemaManager->rebuild($entityTypeList, $mode); - } - catch (Throwable $e) { + } catch (Throwable $e) { $result = false; $this->log->error( diff --git a/application/Espo/Core/Duplicate/Finder.php b/application/Espo/Core/Duplicate/Finder.php index f69a00d82c..50b156b530 100644 --- a/application/Espo/Core/Duplicate/Finder.php +++ b/application/Espo/Core/Duplicate/Finder.php @@ -138,8 +138,7 @@ class Finder ->select(['id']) ->limit(0, self::LIMIT) ->build(); - } - catch (Forbidden|BadRequest $e) { + } catch (Forbidden|BadRequest $e) { throw new RuntimeException($e->getMessage(), 0, $e); } diff --git a/application/Espo/Core/EntryPoint/Starter.php b/application/Espo/Core/EntryPoint/Starter.php index baa34479cb..0e1aa5717f 100644 --- a/application/Espo/Core/EntryPoint/Starter.php +++ b/application/Espo/Core/EntryPoint/Starter.php @@ -100,8 +100,7 @@ class Starter try { $authRequired = $this->entryPointManager->checkAuthRequired($entryPoint); - } - catch (NotFound $exception) { + } catch (NotFound $exception) { $this->errorOutput->processWithBodyPrinting($requestWrapped, $responseWrapped, $exception); (new ResponseEmitter())->emit($responseWrapped->toPsr7()); @@ -143,8 +142,7 @@ class Starter $responseWrapped, $authRequired ); - } - catch (Exception $exception) { + } catch (Exception $exception) { $this->errorOutput->processWithBodyPrinting($requestWrapped, $responseWrapped, $exception); } } diff --git a/application/Espo/Core/ExternalAccount/ClientManager.php b/application/Espo/Core/ExternalAccount/ClientManager.php index 8b96210a3e..94b329f352 100644 --- a/application/Espo/Core/ExternalAccount/ClientManager.php +++ b/application/Espo/Core/ExternalAccount/ClientManager.php @@ -74,8 +74,7 @@ class ClientManager { try { $account = $this->getClientRecord($client); - } - catch (Error) { + } catch (Error) { // @todo Revise. return; } diff --git a/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php b/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php index 65cdf9677d..c396e4f91d 100644 --- a/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php +++ b/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php @@ -276,8 +276,7 @@ abstract class OAuth2Abstract implements IClient $this->request($url); return true; - } - catch (Exception) { + } catch (Exception) { return false; } } @@ -294,8 +293,7 @@ abstract class OAuth2Abstract implements IClient try { $dt = new DateTime($this->getParam('expiresAt')); - } - catch (Exception) { + } catch (Exception) { $this->log->debug("Oauth: Bad expires-at parameter stored for client $this->clientId."); return; @@ -438,8 +436,7 @@ abstract class OAuth2Abstract implements IClient try { $response = $this->client->request($url, $params, $httpMethod, $httpHeaders); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Error($e->getMessage(), 0, $e); } @@ -500,8 +497,7 @@ abstract class OAuth2Abstract implements IClient Client::GRANT_TYPE_REFRESH_TOKEN, ['refresh_token' => $this->refreshToken] ); - } - catch (Exception $e) { + } catch (Exception $e) { $this->unlock(); $this->controlRefreshTokenAttempts(); diff --git a/application/Espo/Core/FieldValidation/FieldValidationManager.php b/application/Espo/Core/FieldValidation/FieldValidationManager.php index c1388282de..f00ed3667c 100644 --- a/application/Espo/Core/FieldValidation/FieldValidationManager.php +++ b/application/Espo/Core/FieldValidation/FieldValidationManager.php @@ -90,8 +90,7 @@ class FieldValidationManager { try { return $this->processInternal($entity, $data, $params, false); - } - catch (ValidationError) { + } catch (ValidationError) { throw new LogicException(); } } diff --git a/application/Espo/Core/FileStorage/Storages/AwsS3.php b/application/Espo/Core/FileStorage/Storages/AwsS3.php index 5da3741bca..09939aae51 100644 --- a/application/Espo/Core/FileStorage/Storages/AwsS3.php +++ b/application/Espo/Core/FileStorage/Storages/AwsS3.php @@ -95,8 +95,7 @@ class AwsS3 implements Storage { try { $this->filesystem->delete($attachment->getSourceId()); - } - catch (FilesystemException $e) { + } catch (FilesystemException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } } @@ -105,8 +104,7 @@ class AwsS3 implements Storage { try { return $this->filesystem->fileExists($attachment->getSourceId()); - } - catch (FilesystemException $e) { + } catch (FilesystemException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } } @@ -115,8 +113,7 @@ class AwsS3 implements Storage { try { return $this->filesystem->fileSize($attachment->getSourceId()); - } - catch (FilesystemException $e) { + } catch (FilesystemException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } } @@ -125,8 +122,7 @@ class AwsS3 implements Storage { try { $resource = $this->filesystem->readStream($attachment->getSourceId()); - } - catch (FilesystemException $e) { + } catch (FilesystemException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } @@ -151,8 +147,7 @@ class AwsS3 implements Storage try { $this->filesystem->writeStream($attachment->getSourceId(), $resource); - } - catch (FilesystemException $e) { + } catch (FilesystemException $e) { throw new RuntimeException($e->getMessage(), 0, $e); } diff --git a/application/Espo/Core/Formula/Evaluator.php b/application/Espo/Core/Formula/Evaluator.php index 3fe3641cd9..c3d05ec4e4 100644 --- a/application/Espo/Core/Formula/Evaluator.php +++ b/application/Espo/Core/Formula/Evaluator.php @@ -120,8 +120,7 @@ class Evaluator try { $result = $processor->process($item); - } - catch (ExecutionException $e) { + } catch (ExecutionException $e) { throw new LogicException('Unexpected ExecutionException.', 0, $e); } diff --git a/application/Espo/Core/Formula/Functions/DatetimeGroup/DiffType.php b/application/Espo/Core/Formula/Functions/DatetimeGroup/DiffType.php index d50d06b301..02efcb6d17 100644 --- a/application/Espo/Core/Formula/Functions/DatetimeGroup/DiffType.php +++ b/application/Espo/Core/Formula/Functions/DatetimeGroup/DiffType.php @@ -107,8 +107,7 @@ class DiffType extends BaseFunction try { $dateTime1 = new DateTime($dateTime1String); $dateTime2 = new DateTime($dateTime2String); - } - catch (\Exception $e) { + } catch (\Exception $e) { return null; } diff --git a/application/Espo/Core/Formula/Functions/DatetimeGroup/TodayType.php b/application/Espo/Core/Formula/Functions/DatetimeGroup/TodayType.php index 6c6caf397c..8539e53dae 100644 --- a/application/Espo/Core/Formula/Functions/DatetimeGroup/TodayType.php +++ b/application/Espo/Core/Formula/Functions/DatetimeGroup/TodayType.php @@ -55,8 +55,7 @@ class TodayType implements Func try { $today = DateTime::createNow() ->withTimezone(new DateTimeZone($timezone)); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Formula/Functions/EntityGroup/CountRelatedType.php b/application/Espo/Core/Formula/Functions/EntityGroup/CountRelatedType.php index 02085a7d86..0e909b7ebc 100644 --- a/application/Espo/Core/Formula/Functions/EntityGroup/CountRelatedType.php +++ b/application/Espo/Core/Formula/Functions/EntityGroup/CountRelatedType.php @@ -90,8 +90,7 @@ class CountRelatedType extends \Espo\Core\Formula\Functions\Base implements try { $query = $builder->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new Error($e->getMessage()); } diff --git a/application/Espo/Core/Formula/Functions/ExtGroup/EmailGroup/SendType.php b/application/Espo/Core/Formula/Functions/ExtGroup/EmailGroup/SendType.php index adcefd3ed7..ff49d0c6e6 100644 --- a/application/Espo/Core/Formula/Functions/ExtGroup/EmailGroup/SendType.php +++ b/application/Espo/Core/Formula/Functions/ExtGroup/EmailGroup/SendType.php @@ -121,8 +121,7 @@ class SendType extends BaseFunction implements try { $sendService->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); $this->log("Error while sending. Message: {$message}." , 'error'); diff --git a/application/Espo/Core/Formula/Functions/ExtGroup/PdfGroup/GenerateType.php b/application/Espo/Core/Formula/Functions/ExtGroup/PdfGroup/GenerateType.php index 16defbcbd5..8af1e9c551 100644 --- a/application/Espo/Core/Formula/Functions/ExtGroup/PdfGroup/GenerateType.php +++ b/application/Espo/Core/Formula/Functions/ExtGroup/PdfGroup/GenerateType.php @@ -84,8 +84,7 @@ class GenerateType extends BaseFunction implements try { $entity = $em->getEntity($entityType, $id); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log("Message: " . $e->getMessage() . "."); throw new Error(); @@ -125,8 +124,7 @@ class GenerateType extends BaseFunction implements $template->getId(), $params ); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log("Error while generating. Message: " . $e->getMessage() . ".", 'error'); throw new Error(); diff --git a/application/Espo/Core/Formula/Functions/ExtGroup/SmsGroup/SendType.php b/application/Espo/Core/Formula/Functions/ExtGroup/SmsGroup/SendType.php index 6626a67df6..50c6cbb9c6 100644 --- a/application/Espo/Core/Formula/Functions/ExtGroup/SmsGroup/SendType.php +++ b/application/Espo/Core/Formula/Functions/ExtGroup/SmsGroup/SendType.php @@ -79,8 +79,7 @@ class SendType extends BaseFunction implements $this->createSender()->send($sms); $this->entityManager->saveEntity($sms); - } - catch (Exception $e) { + } catch (Exception $e) { $message = $e->getMessage(); $this->log("Error while sending SMS. Message: {$message}." , 'error'); diff --git a/application/Espo/Core/Formula/Functions/WhileType.php b/application/Espo/Core/Formula/Functions/WhileType.php index 1860cda3ac..efb9193020 100644 --- a/application/Espo/Core/Formula/Functions/WhileType.php +++ b/application/Espo/Core/Formula/Functions/WhileType.php @@ -44,11 +44,9 @@ class WhileType extends BaseFunction while ($this->evaluate($args[0])) { try { $this->evaluate($args[1]); - } - catch (BreakLoop) { + } catch (BreakLoop) { break; - } - catch (ContinueLoop) { + } catch (ContinueLoop) { continue; } } diff --git a/application/Espo/Core/Formula/Processor.php b/application/Espo/Core/Formula/Processor.php index 50486dc945..387e9665a3 100644 --- a/application/Espo/Core/Formula/Processor.php +++ b/application/Espo/Core/Formula/Processor.php @@ -178,8 +178,7 @@ class Processor } return $function->process($evaluatedArguments); - } - catch (TooFewArguments|BadArgumentType|BadArgumentValue $e) { + } catch (TooFewArguments|BadArgumentType|BadArgumentValue $e) { $message = sprintf('Function %s; %s', $item->getType(), $e->getLogMessage()); throw new Error($message); diff --git a/application/Espo/Core/Htmlizer/Htmlizer.php b/application/Espo/Core/Htmlizer/Htmlizer.php index f4209e8dec..69f5819090 100644 --- a/application/Espo/Core/Htmlizer/Htmlizer.php +++ b/application/Espo/Core/Htmlizer/Htmlizer.php @@ -504,8 +504,7 @@ class Htmlizer try { $query = $selectBuilder->build(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage(), 0, $e); } @@ -960,8 +959,7 @@ class Htmlizer } $wrapperElement->setAttribute('v', $element->getAttribute($attribute)); - } - catch (DOMException $e) { + } catch (DOMException $e) { throw new LogicException($e->getMessage()); } diff --git a/application/Espo/Core/InjectableFactory.php b/application/Espo/Core/InjectableFactory.php index f5c4f2930c..c09e528e09 100644 --- a/application/Espo/Core/InjectableFactory.php +++ b/application/Espo/Core/InjectableFactory.php @@ -243,8 +243,7 @@ class InjectableFactory $dependencyClassName = $type->getName(); $dependencyClass = new ReflectionClass($dependencyClassName); - } - catch (Throwable $e) { + } catch (Throwable $e) { $badClassName = $type->getName(); // This trick allows to log syntax errors. @@ -326,8 +325,7 @@ class InjectableFactory if ($type === Binding::CONTAINER_SERVICE) { try { return $this->container->get($value); - } - catch (NotFoundExceptionInterface $e) { + } catch (NotFoundExceptionInterface $e) { throw new RuntimeException($e->getMessage()); } } diff --git a/application/Espo/Core/Job/JobManager.php b/application/Espo/Core/Job/JobManager.php index e12826c789..a130281911 100644 --- a/application/Espo/Core/Job/JobManager.php +++ b/application/Espo/Core/Job/JobManager.php @@ -152,8 +152,7 @@ class JobManager if ($this->fileManager->isFile($this->lastRunTimeFile)) { try { $data = $this->fileManager->getPhpContents($this->lastRunTimeFile); - } - catch (RuntimeException) { + } catch (RuntimeException) { $data = null; } diff --git a/application/Espo/Core/Job/JobRunner.php b/application/Espo/Core/Job/JobRunner.php index add20aee10..2e91c2e7bf 100644 --- a/application/Espo/Core/Job/JobRunner.php +++ b/application/Espo/Core/Job/JobRunner.php @@ -58,8 +58,7 @@ class JobRunner { try { $this->runInternal($jobEntity); - } - catch (Throwable $e) { + } catch (Throwable $e) { throw new LogicException($e->getMessage()); } } diff --git a/application/Espo/Core/Job/JobTask.php b/application/Espo/Core/Job/JobTask.php index 8ddcae1897..70cf066dee 100644 --- a/application/Espo/Core/Job/JobTask.php +++ b/application/Espo/Core/Job/JobTask.php @@ -64,8 +64,7 @@ class JobTask extends AsyncTask try { $app->run(JobRunner::class, $params); - } - catch (Throwable $e) { + } catch (Throwable $e) { $log = $app->getContainer()->getByClass(Log::class); $log->error("JobTask: Failed to run job '$this->jobId'. Error: " . $e->getMessage()); diff --git a/application/Espo/Core/Job/QueueUtil.php b/application/Espo/Core/Job/QueueUtil.php index 2997900719..89ba466c4a 100644 --- a/application/Espo/Core/Job/QueueUtil.php +++ b/application/Espo/Core/Job/QueueUtil.php @@ -181,8 +181,7 @@ class QueueUtil { try { $dateObj = new DateTime($time); - } - catch (Exception $e) { + } catch (Exception $e) { throw new LogicException($e->getMessage()); } diff --git a/application/Espo/Core/Job/ScheduleProcessor.php b/application/Espo/Core/Job/ScheduleProcessor.php index 7f24093907..b4889fceaf 100644 --- a/application/Espo/Core/Job/ScheduleProcessor.php +++ b/application/Espo/Core/Job/ScheduleProcessor.php @@ -79,8 +79,7 @@ class ScheduleProcessor $isRunning = in_array($scheduledJob->getId(), $runningScheduledJobIdList); $this->createJobsFromScheduledJob($scheduledJob, $isRunning); - } - catch (Throwable $e) { + } catch (Throwable $e) { $id = $scheduledJob->getId(); $this->log->error("Scheduled Job '$id': " . $e->getMessage()); @@ -165,8 +164,7 @@ class ScheduleProcessor try { $cronExpression = CronExpression::factory($scheduling); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->error( "Scheduled Job '$id': Scheduling expression error: " . $e->getMessage() . '.'); @@ -179,8 +177,7 @@ class ScheduleProcessor try { $next = $cronExpression->getNextRunDate(timeZone: $timeZone) ->setTimezone(new DateTimeZone('UTC')); - } - catch (Exception) { + } catch (Exception) { $this->log->error("Scheduled Job '$id': Unsupported scheduling expression '$scheduling'."); return null; diff --git a/application/Espo/Core/Log/Handler/DatabaseHandler.php b/application/Espo/Core/Log/Handler/DatabaseHandler.php index f7cf959762..78d2afde05 100644 --- a/application/Espo/Core/Log/Handler/DatabaseHandler.php +++ b/application/Espo/Core/Log/Handler/DatabaseHandler.php @@ -79,8 +79,7 @@ class DatabaseHandler implements HandlerInterface $this->setRequest($record, $logRecord); $this->entityManager->saveEntity($logRecord); - } - catch (Throwable) { + } catch (Throwable) { // Nowhere to log. } diff --git a/application/Espo/Core/Log/Handler/EspoFileHandler.php b/application/Espo/Core/Log/Handler/EspoFileHandler.php index 330e33d62f..6d00abed9d 100644 --- a/application/Espo/Core/Log/Handler/EspoFileHandler.php +++ b/application/Espo/Core/Log/Handler/EspoFileHandler.php @@ -77,8 +77,7 @@ class EspoFileHandler extends MonologStreamHandler $this->url, $this->pruneMessage($record) ); - } - catch (Throwable $e) { + } catch (Throwable $e) { $msg = "Could not write file `$this->url`."; if ($e->getMessage()) { diff --git a/application/Espo/Core/Mail/Account/Fetcher.php b/application/Espo/Core/Mail/Account/Fetcher.php index 7baa58084d..fb339a7e43 100644 --- a/application/Espo/Core/Mail/Account/Fetcher.php +++ b/application/Espo/Core/Mail/Account/Fetcher.php @@ -114,8 +114,7 @@ class Fetcher try { $storage->selectFolder($folderOriginal); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "{$account->getEntityType()} {$account->getId()}, " . "could not select folder '$folder'; [{$e->getCode()}] {$e->getMessage()}" @@ -316,8 +315,7 @@ class Fetcher ) { $storage->setFlags($id, self::flagsWithoutRecent($flags)); } - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "{$account->getEntityType()} {$account->getId()}, get message; " . "{$e->getCode()} {$e->getMessage()}" @@ -338,8 +336,7 @@ class Fetcher $email, $hookResult ?? BeforeFetchHookResult::create() ); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "{$account->getEntityType()} {$account->getId()}, after-fetch hook; " . "{$e->getCode()} {$e->getMessage()}" @@ -355,8 +352,7 @@ class Fetcher try { return $this->beforeFetchHook->process($account, $message); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "{$account->getEntityType()} {$account->getId()}, before-fetch hook; " . "{$e->getCode()} {$e->getMessage()}" @@ -417,8 +413,7 @@ class Fetcher try { $size = $storage->getSize($id); - } - catch (Throwable) { + } catch (Throwable) { return false; } @@ -437,8 +432,7 @@ class Fetcher try { return $this->importer->import($message, $data); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "{$account->getEntityType()} {$account->getId()}, import message; " . "{$e->getCode()} {$e->getMessage()}" diff --git a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php index 52398b9530..e5e74d6895 100644 --- a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php +++ b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php @@ -320,8 +320,7 @@ class AfterFetch implements AfterFetchInterface ->send($reply); $this->entityManager->saveEntity($reply); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Inbound Email: Auto-reply error: " . $e->getMessage()); } } diff --git a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/BeforeFetch.php b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/BeforeFetch.php index d5be01cb7f..06ec655a5f 100644 --- a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/BeforeFetch.php +++ b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/BeforeFetch.php @@ -68,8 +68,7 @@ class BeforeFetch implements BeforeFetchInterface if ($this->bouncedRecognizer->isBounced($message)) { try { $toSkip = $this->processBounced($message); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( 'InboundEmail ' . $account->getId() . ' ' . 'Process Bounced Message; ' . $e->getCode() . ' ' . $e->getMessage() diff --git a/application/Espo/Core/Mail/Account/GroupAccount/Service.php b/application/Espo/Core/Mail/Account/GroupAccount/Service.php index 12b919c15e..9acd447eb4 100644 --- a/application/Espo/Core/Mail/Account/GroupAccount/Service.php +++ b/application/Espo/Core/Mail/Account/GroupAccount/Service.php @@ -66,8 +66,7 @@ class Service try { $this->fetcher->fetch($account); - } - catch (ImapError $e) { + } catch (ImapError $e) { $this->notificationHelper->processImapError($account); throw $e; @@ -112,8 +111,7 @@ class Service try { $storage = $this->storageFactory->createWithParams($params); $storage->getFolderNames(); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->warning("IMAP test connection failed; {message}", [ 'exception' => $e, 'message' => $e->getMessage(), diff --git a/application/Espo/Core/Mail/Account/GroupAccount/StorageFactory.php b/application/Espo/Core/Mail/Account/GroupAccount/StorageFactory.php index 8dc9787f8b..13560d1ac0 100644 --- a/application/Espo/Core/Mail/Account/GroupAccount/StorageFactory.php +++ b/application/Espo/Core/Mail/Account/GroupAccount/StorageFactory.php @@ -97,8 +97,7 @@ class StorageFactory implements StorageFactoryInterface if ($handlerClassName && !empty($rawParams['id'])) { try { $handler = $this->injectableFactory->create($handlerClassName); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("InboundEmail: Could not create Imap Handler. Error: " . $e->getMessage()); } @@ -126,8 +125,7 @@ class StorageFactory implements StorageFactoryInterface try { $storage = new Imap($imapParams); - } - catch (RuntimeException|InvalidArgumentException|ProtocolRuntimeException $e) { + } catch (RuntimeException|InvalidArgumentException|ProtocolRuntimeException $e) { throw new ImapError($e->getMessage(), 0, $e); } diff --git a/application/Espo/Core/Mail/Account/PersonalAccount/Service.php b/application/Espo/Core/Mail/Account/PersonalAccount/Service.php index 7f025b8c6f..eb24b608c6 100644 --- a/application/Espo/Core/Mail/Account/PersonalAccount/Service.php +++ b/application/Espo/Core/Mail/Account/PersonalAccount/Service.php @@ -69,8 +69,7 @@ class Service try { $this->fetcher->fetch($account); - } - catch (ImapError $e) { + } catch (ImapError $e) { $this->notificationHelper->processImapError($account); throw $e; @@ -148,8 +147,7 @@ class Service try { $storage = $this->storageFactory->createWithParams($params); $storage->getFolderNames(); - } - catch (Exception $e) { + } catch (Exception $e) { $this->log->warning("IMAP test connection failed; {message}", [ 'exception' => $e, 'message' => $e->getMessage(), diff --git a/application/Espo/Core/Mail/Account/PersonalAccount/StorageFactory.php b/application/Espo/Core/Mail/Account/PersonalAccount/StorageFactory.php index 232cb36f0f..6fe9ec77b0 100644 --- a/application/Espo/Core/Mail/Account/PersonalAccount/StorageFactory.php +++ b/application/Espo/Core/Mail/Account/PersonalAccount/StorageFactory.php @@ -115,8 +115,7 @@ class StorageFactory implements StorageFactoryInterface if ($handlerClassName && !empty($rawParams['id'])) { try { $handler = $this->injectableFactory->create($handlerClassName); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "EmailAccount: Could not create Imap Handler. Error: " . $e->getMessage() ); @@ -144,8 +143,7 @@ class StorageFactory implements StorageFactoryInterface try { $handler = $this->injectableFactory->create($handlerClassName); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error( "EmailAccount: Could not create Imap Handler for {$emailAddress}. Error: " . $e->getMessage() @@ -175,8 +173,7 @@ class StorageFactory implements StorageFactoryInterface try { $storage = new Imap($imapParams); - } - catch (RuntimeException|InvalidArgumentException|ProtocolRuntimeException $e) { + } catch (RuntimeException|InvalidArgumentException|ProtocolRuntimeException $e) { throw new ImapError($e->getMessage(), 0, $e); } diff --git a/application/Espo/Core/Mail/Account/SendingAccountProvider.php b/application/Espo/Core/Mail/Account/SendingAccountProvider.php index fe2eb2175f..4ab367b10a 100644 --- a/application/Espo/Core/Mail/Account/SendingAccountProvider.php +++ b/application/Espo/Core/Mail/Account/SendingAccountProvider.php @@ -118,8 +118,7 @@ class SendingAccountProvider try { return $this->groupAccountFactory->create($entity->getId()); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException(); } } @@ -150,8 +149,7 @@ class SendingAccountProvider try { return $this->groupAccountFactory->create($entity->getId()); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException(); } } @@ -193,8 +191,7 @@ class SendingAccountProvider try { return $this->personalAccountFactory->create($entity->getId()); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException(); } } @@ -249,8 +246,7 @@ class SendingAccountProvider try { $this->system = $this->groupAccountFactory->create($entity->getId()); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException(); } } diff --git a/application/Espo/Core/Mail/Importer/DefaultImporter.php b/application/Espo/Core/Mail/Importer/DefaultImporter.php index 26625b7ee5..5c7d4d533d 100644 --- a/application/Espo/Core/Mail/Importer/DefaultImporter.php +++ b/application/Espo/Core/Mail/Importer/DefaultImporter.php @@ -209,8 +209,7 @@ class DefaultImporter implements Importer $dateSent = new DateTime($dateHeaderValue); $email->setDateSent(DateTimeField::fromDateTime($dateSent)); - } - catch (Exception) {} + } catch (Exception) {} } $duplicate = $this->findDuplicate($email, $message); @@ -246,8 +245,7 @@ class DefaultImporter implements Importer ->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); $email->set('deliveryDate', $deliveryDate); - } - catch (Exception) {} + } catch (Exception) {} } $inlineAttachmentList = []; diff --git a/application/Espo/Core/Mail/Sender.php b/application/Espo/Core/Mail/Sender.php index dc6dc655d4..7dc3f7551d 100644 --- a/application/Espo/Core/Mail/Sender.php +++ b/application/Espo/Core/Mail/Sender.php @@ -589,8 +589,7 @@ class Sender $email->setStatus(Email::STATUS_SENT); $email->set('dateSent', DateTime::createNow()->toString()); - } - catch (Exception $e) { + } catch (Exception $e) { /** @noinspection PhpDeprecationInspection */ $this->resetParams(); /** @noinspection PhpDeprecationInspection */ diff --git a/application/Espo/Core/MassAction/Api/PostProcess.php b/application/Espo/Core/MassAction/Api/PostProcess.php index 53eb502a39..f5c1706453 100644 --- a/application/Espo/Core/MassAction/Api/PostProcess.php +++ b/application/Espo/Core/MassAction/Api/PostProcess.php @@ -69,8 +69,7 @@ class PostProcess implements Action try { $massActionParams = Params::fromRaw($rawParams, $entityType); - } - catch (RuntimeException $e) { + } catch (RuntimeException $e) { throw new BadRequest($e->getMessage()); } diff --git a/application/Espo/Core/MassAction/Jobs/Process.php b/application/Espo/Core/MassAction/Jobs/Process.php index 291c99ae2c..a65ba5f453 100644 --- a/application/Espo/Core/MassAction/Jobs/Process.php +++ b/application/Espo/Core/MassAction/Jobs/Process.php @@ -83,8 +83,7 @@ class Process implements Job $params, $entity->getData() ); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->setFailed($entity); throw new Error("Mass action job error: " . $e->getMessage()); diff --git a/application/Espo/Core/PhoneNumber/Sanitizer.php b/application/Espo/Core/PhoneNumber/Sanitizer.php index 8081fcc683..b0b204796f 100644 --- a/application/Espo/Core/PhoneNumber/Sanitizer.php +++ b/application/Espo/Core/PhoneNumber/Sanitizer.php @@ -70,8 +70,7 @@ class Sanitizer try { $number = PhoneNumber::parse($value, $countryCode); - } - catch (PhoneNumberParseException) { + } catch (PhoneNumberParseException) { return $value; } diff --git a/application/Espo/Core/Portal/Container.php b/application/Espo/Core/Portal/Container.php index 36a6e6e992..87513fe9b1 100644 --- a/application/Espo/Core/Portal/Container.php +++ b/application/Espo/Core/Portal/Container.php @@ -72,8 +72,7 @@ class Container extends BaseContainer /** @var AclManager $aclManager */ $aclManager = $this->get(self::ID_ACL_MANAGER); - } - catch (NotFoundExceptionInterface) { + } catch (NotFoundExceptionInterface) { throw new LogicException(); } diff --git a/application/Espo/Core/Portal/Container/ContainerConfiguration.php b/application/Espo/Core/Portal/Container/ContainerConfiguration.php index 95659408a7..4b868769d6 100644 --- a/application/Espo/Core/Portal/Container/ContainerConfiguration.php +++ b/application/Espo/Core/Portal/Container/ContainerConfiguration.php @@ -42,8 +42,7 @@ class ContainerConfiguration extends BaseContainerConfiguration try { $className = $this->metadata->get(['app', 'portalContainerServices', $name, 'loaderClassName']); - } - catch (\Exception) {} + } catch (\Exception) {} if ($className && class_exists($className)) { return $className; diff --git a/application/Espo/Core/Record/Formula/Processor.php b/application/Espo/Core/Record/Formula/Processor.php index 8ca9953102..2bb4357127 100644 --- a/application/Espo/Core/Record/Formula/Processor.php +++ b/application/Espo/Core/Record/Formula/Processor.php @@ -90,8 +90,7 @@ class Processor { try { $this->formulaManager->run($script, $entity, $variables); - } - catch (FormulaError $e) { + } catch (FormulaError $e) { throw new RuntimeException('Formula script error.', 500, $e); } } diff --git a/application/Espo/Core/Record/SearchParamsFetcher.php b/application/Espo/Core/Record/SearchParamsFetcher.php index 8a66e9dc7e..aeb5260d4c 100644 --- a/application/Espo/Core/Record/SearchParamsFetcher.php +++ b/application/Espo/Core/Record/SearchParamsFetcher.php @@ -59,8 +59,7 @@ class SearchParamsFetcher { try { return SearchParams::fromRaw($this->fetchRaw($request)); - } - catch (InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { throw new BadRequest($e->getMessage()); } } @@ -89,8 +88,7 @@ class SearchParamsFetcher { try { return Json::decode($request->getQueryParam('searchParams') ?? '', true); - } - catch (JsonException) { + } catch (JsonException) { throw new BadRequest("Invalid search params JSON."); } } diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index e368953a31..89d29bfe24 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -382,8 +382,7 @@ class Service implements Crud, ->buildQueryBuilder() ->order([]) ->build(); - } - catch (BadRequest $e) { + } catch (BadRequest $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Repositories/Event.php b/application/Espo/Core/Repositories/Event.php index ea638d44da..d43a18b5e9 100644 --- a/application/Espo/Core/Repositories/Event.php +++ b/application/Espo/Core/Repositories/Event.php @@ -134,8 +134,7 @@ class Event extends Database implements try { $tz = new DateTimeZone($timeZone); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Select/AccessControl/FilterResolverFactory.php b/application/Espo/Core/Select/AccessControl/FilterResolverFactory.php index 8d25c81b1d..cc1239e065 100644 --- a/application/Espo/Core/Select/AccessControl/FilterResolverFactory.php +++ b/application/Espo/Core/Select/AccessControl/FilterResolverFactory.php @@ -60,8 +60,7 @@ class FilterResolverFactory $acl = $this->userAclManagerProvider ->get($user) ->createUserAcl($user); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Select/Where/CheckerFactory.php b/application/Espo/Core/Select/Where/CheckerFactory.php index a52fa0c79d..dfa7160f81 100644 --- a/application/Espo/Core/Select/Where/CheckerFactory.php +++ b/application/Espo/Core/Select/Where/CheckerFactory.php @@ -48,8 +48,7 @@ class CheckerFactory $acl = $this->userAclManagerProvider ->get($user) ->createUserAcl($user); - } - catch (NotAvailable $e) { + } catch (NotAvailable $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php b/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php index b77235a2be..124ba8c2a8 100644 --- a/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php +++ b/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php @@ -91,8 +91,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime('now', new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad timezone"); } @@ -223,8 +222,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime($value, new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad date value or timezone."); } @@ -249,8 +247,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime($value, new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad date value or timezone."); } @@ -265,8 +262,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime($value, new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad date value or timezone."); } @@ -289,8 +285,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime($value[0], new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad date value or timezone."); } @@ -300,8 +295,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime($value[1], new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad date value or timezone."); } @@ -346,8 +340,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt = new DateTime('now', new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad timezone."); } @@ -367,8 +360,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dtFrom->add(new DateInterval('P' . (($quarter - 1) * 3) . 'M')); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException(); } @@ -390,8 +382,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dtFrom = new DateTime('now', new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad timezone."); } @@ -419,8 +410,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dtToday = new DateTime('now', new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad timezone."); } @@ -460,8 +450,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dtToday = new DateTime('now', new DateTimeZone($timeZone)); - } - catch (Exception) { + } catch (Exception) { throw new BadRequest("Bad timezone."); } @@ -482,8 +471,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer if ($quarterShift >= 0) { try { $dt->add(new DateInterval('P' . ($quarterShift * 3) . 'M')); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException(); } } else { @@ -491,8 +479,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer try { $dt->sub(new DateInterval('P' . ($quarterShift * 3) . 'M')); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException(); } } diff --git a/application/Espo/Core/Select/Where/ItemGeneralConverter.php b/application/Espo/Core/Select/Where/ItemGeneralConverter.php index 169d6cca99..f1c5c6b5c8 100644 --- a/application/Espo/Core/Select/Where/ItemGeneralConverter.php +++ b/application/Espo/Core/Select/Where/ItemGeneralConverter.php @@ -1663,8 +1663,7 @@ class ItemGeneralConverter implements ItemConverter try { return new DateTimeZone($timeZone); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } } @@ -1682,8 +1681,7 @@ class ItemGeneralConverter implements ItemConverter try { return new DateTimeZone($timeZone); - } - catch (Exception $e) { + } catch (Exception $e) { throw new BadRequest($e->getMessage()); } } diff --git a/application/Espo/Core/Upgrades/Actions/Base.php b/application/Espo/Core/Upgrades/Actions/Base.php index b4902372ad..dc747411c6 100644 --- a/application/Espo/Core/Upgrades/Actions/Base.php +++ b/application/Espo/Core/Upgrades/Actions/Base.php @@ -307,8 +307,7 @@ abstract class Base try { $isInRange = Semver::satisfies($currentVersion, $version); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->getLog()->error("SemVer: Version identification error: {$e->getMessage()}."); } @@ -396,8 +395,7 @@ abstract class Base assert(method_exists($script, 'run')); $script->run($this->getContainer(), $this->scriptParams); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->throwErrorAndRemovePackage(exception: $e); } } @@ -626,8 +624,7 @@ abstract class Base try { return $this->getFileManager()->copy($sourcePath, $destPath, $recursively, $fileList, $copyOnlyFiles); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->throwErrorAndRemovePackage(exception: $e); } @@ -860,8 +857,7 @@ abstract class Base $dataManager->updateAppTimestamp(); return true; - } - catch (Throwable $e) { + } catch (Throwable $e) { try { $this->getLog()->error("Database rebuild failure, details: {$e->getMessage()}.", ['exception' => $e]); } catch (Throwable) {} diff --git a/application/Espo/Core/Upgrades/Actions/Extension/Install.php b/application/Espo/Core/Upgrades/Actions/Extension/Install.php index 87f7e02172..22222e0259 100644 --- a/application/Espo/Core/Upgrades/Actions/Extension/Install.php +++ b/application/Espo/Core/Upgrades/Actions/Extension/Install.php @@ -163,8 +163,7 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install try { $entityManager->saveEntity($extensionEntity); - } - catch (Throwable $e) { + } catch (Throwable $e) { $msg = "Error while saving the extension entity. The error occurred in an existing hook. " . "{$e->getMessage()} at {$e->getFile()}:{$e->getLine()}"; diff --git a/application/Espo/Core/Upgrades/Actions/Extension/Uninstall.php b/application/Espo/Core/Upgrades/Actions/Extension/Uninstall.php index c20e151720..d6ba6e618d 100644 --- a/application/Espo/Core/Upgrades/Actions/Extension/Uninstall.php +++ b/application/Espo/Core/Upgrades/Actions/Extension/Uninstall.php @@ -70,8 +70,7 @@ class Uninstall extends \Espo\Core\Upgrades\Actions\Base\Uninstall try { $this->getEntityManager()->saveEntity($extensionEntity); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->getLog()->error( 'Error saving Extension entity. The error occurred by existing Hook, more details: ' . $e->getMessage() .' at '. $e->getFile() . ':' . $e->getLine() diff --git a/application/Espo/Core/Upgrades/Migration/AfterUpgradeRunner.php b/application/Espo/Core/Upgrades/Migration/AfterUpgradeRunner.php index af80e6f39b..d1cb1a57e5 100644 --- a/application/Espo/Core/Upgrades/Migration/AfterUpgradeRunner.php +++ b/application/Espo/Core/Upgrades/Migration/AfterUpgradeRunner.php @@ -53,8 +53,7 @@ class AfterUpgradeRunner try { $this->dataManager->rebuild(); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException("Error while rebuild: " . $e->getMessage()); } @@ -64,8 +63,7 @@ class AfterUpgradeRunner try { $this->dataManager->rebuild(); - } - catch (Error $e) { + } catch (Error $e) { throw new RuntimeException("Error while rebuild: " . $e->getMessage()); } } diff --git a/application/Espo/Core/Upgrades/Migration/Runner.php b/application/Espo/Core/Upgrades/Migration/Runner.php index d53dfe2d21..4eb5b6f918 100644 --- a/application/Espo/Core/Upgrades/Migration/Runner.php +++ b/application/Espo/Core/Upgrades/Migration/Runner.php @@ -110,8 +110,7 @@ class Runner try { $this->stepRunner->runPrepare($step); - } - catch (Exception $e) { + } catch (Exception $e) { $io->writeLine(" FAIL"); throw new RuntimeException($e->getMessage()); diff --git a/application/Espo/Core/Utils/Autoload.php b/application/Espo/Core/Utils/Autoload.php index a2b8c3ec55..7929056263 100644 --- a/application/Espo/Core/Utils/Autoload.php +++ b/application/Espo/Core/Utils/Autoload.php @@ -162,8 +162,7 @@ class Autoload { try { $data = $this->getData(); - } - catch (Exception) {} // bad permissions + } catch (Exception) {} // bad permissions if (empty($data)) { return; diff --git a/application/Espo/Core/Utils/Autoload/NamespaceLoader.php b/application/Espo/Core/Utils/Autoload/NamespaceLoader.php index 027a4b2ca3..d6cb89a904 100644 --- a/application/Espo/Core/Utils/Autoload/NamespaceLoader.php +++ b/application/Espo/Core/Utils/Autoload/NamespaceLoader.php @@ -209,8 +209,7 @@ class NamespaceLoader try { $this->classLoader->$methodName($prefix, $path); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Could not add '{$prefix}' to autoload: " . $e->getMessage()); continue; diff --git a/application/Espo/Core/Utils/Config/ConfigWriter.php b/application/Espo/Core/Utils/Config/ConfigWriter.php index 2d0f750f2b..ac404dfecf 100644 --- a/application/Espo/Core/Utils/Config/ConfigWriter.php +++ b/application/Espo/Core/Utils/Config/ConfigWriter.php @@ -173,8 +173,7 @@ class ConfigWriter try { $this->fileManager->putPhpContents($path, $data); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException("Could not save config."); } @@ -189,8 +188,7 @@ class ConfigWriter try { $this->fileManager->putPhpContentsNoRenaming($path, $data); - } - catch (Exception) { + } catch (Exception) { throw new RuntimeException("Could not save config."); } } diff --git a/application/Espo/Core/Utils/Database/Schema/SchemaManager.php b/application/Espo/Core/Utils/Database/Schema/SchemaManager.php index ff32749f72..b4eda43eef 100644 --- a/application/Espo/Core/Utils/Database/Schema/SchemaManager.php +++ b/application/Espo/Core/Utils/Database/Schema/SchemaManager.php @@ -138,8 +138,7 @@ class SchemaManager try { $this->processPreRebuildActions($fromSchema, $schema); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->alert('Rebuild database pre-rebuild error: '. $e->getMessage()); return false; @@ -175,8 +174,7 @@ class SchemaManager try { $this->processPostRebuildActions($fromSchema, $schema); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->alert('Rebuild database post-rebuild error: ' . $e->getMessage()); return false; @@ -200,8 +198,7 @@ class SchemaManager try { $connection->executeQuery($sql); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->alert('Rebuild database error: ' . $e->getMessage()); $result = false; diff --git a/application/Espo/Core/Utils/DateTime.php b/application/Espo/Core/Utils/DateTime.php index 0ad0da52d7..d5d21a919f 100644 --- a/application/Espo/Core/Utils/DateTime.php +++ b/application/Espo/Core/Utils/DateTime.php @@ -66,8 +66,7 @@ class DateTime try { $this->timezone = new DateTimeZone($timeZone ?? 'UTC'); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } } @@ -143,8 +142,7 @@ class DateTime try { $tz = $timezone ? new DateTimeZone($timezone) : $this->timezone; - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } @@ -166,8 +164,7 @@ class DateTime { try { $tz = $timezone ? new DateTimeZone($timezone) : $this->timezone; - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } @@ -190,8 +187,7 @@ class DateTime { try { $tz = $timezone ? new DateTimeZone($timezone) : $this->timezone; - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Core/Utils/File/Manager.php b/application/Espo/Core/Utils/File/Manager.php index 130e78ab1d..6ee668b505 100644 --- a/application/Espo/Core/Utils/File/Manager.php +++ b/application/Espo/Core/Utils/File/Manager.php @@ -1202,7 +1202,6 @@ class Manager try { opcache_invalidate($filepath, $force); - } - catch (Throwable $e) {} + } catch (Throwable $e) {} } } diff --git a/application/Espo/Core/WebSocket/Submission.php b/application/Espo/Core/WebSocket/Submission.php index 0588342ba0..4fe8c6d192 100644 --- a/application/Espo/Core/WebSocket/Submission.php +++ b/application/Espo/Core/WebSocket/Submission.php @@ -64,8 +64,7 @@ class Submission try { $this->sender->send($message); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("WebSocketSubmission: " . $e->getMessage()); } } diff --git a/application/Espo/Core/Webhook/Queue.php b/application/Espo/Core/Webhook/Queue.php index dd5925b231..ae4e6faeb3 100644 --- a/application/Espo/Core/Webhook/Queue.php +++ b/application/Espo/Core/Webhook/Queue.php @@ -267,8 +267,7 @@ class Queue { try { $code = $this->sender->send($webhook, $dataList); - } - catch (Exception $e) { + } catch (Exception $e) { $this->failQueueItemList($itemList, true); $this->log->error("Webhook Queue: Webhook '{$webhook->getId()}' sending failed. Error: {$e->getMessage()}"); diff --git a/application/Espo/Modules/Crm/Jobs/SendEmailReminders.php b/application/Espo/Modules/Crm/Jobs/SendEmailReminders.php index 45d678a252..62b77a9365 100644 --- a/application/Espo/Modules/Crm/Jobs/SendEmailReminders.php +++ b/application/Espo/Modules/Crm/Jobs/SendEmailReminders.php @@ -83,8 +83,7 @@ class SendEmailReminders implements JobDataLess foreach ($collection as $entity) { try { $emailReminder->send($entity); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Email reminder '{$entity->getId()}': " . $e->getMessage()); } diff --git a/application/Espo/Modules/Crm/Tools/MassEmail/SendingProcessor.php b/application/Espo/Modules/Crm/Tools/MassEmail/SendingProcessor.php index 8513f8f874..4650a269bc 100644 --- a/application/Espo/Modules/Crm/Tools/MassEmail/SendingProcessor.php +++ b/application/Espo/Modules/Crm/Tools/MassEmail/SendingProcessor.php @@ -304,8 +304,7 @@ class SendingProcessor ->withMessage($message) ->withAttachments($attachmentList) ->send($email); - } - catch (Exception $e) { + } catch (Exception $e) { $this->processException($queueItem, $e); return; diff --git a/application/Espo/ORM/Executor/DefaultSqlExecutor.php b/application/Espo/ORM/Executor/DefaultSqlExecutor.php index af8a720bfc..f479e83096 100644 --- a/application/Espo/ORM/Executor/DefaultSqlExecutor.php +++ b/application/Espo/ORM/Executor/DefaultSqlExecutor.php @@ -75,8 +75,7 @@ class DefaultSqlExecutor implements SqlExecutor try { $sth = $this->pdo->query($sql); - } - catch (Exception $e) { + } catch (Exception $e) { $counter--; if ($counter === 0 || !$this->isExceptionIsDeadlock($e)) { diff --git a/application/Espo/Services/RecordTree.php b/application/Espo/Services/RecordTree.php index 26e19a1eb9..6bbe311fa7 100644 --- a/application/Espo/Services/RecordTree.php +++ b/application/Espo/Services/RecordTree.php @@ -165,8 +165,7 @@ class RecordTree extends Record if (!$this->acl->checkScope($this->getSubjectEntityType(), Table::ACTION_CREATE)) { return true; } - } - catch (NotImplemented) { + } catch (NotImplemented) { return false; } diff --git a/application/Espo/Tools/App/AppService.php b/application/Espo/Tools/App/AppService.php index bd521cb5b5..ed55f6a38d 100644 --- a/application/Espo/Tools/App/AppService.php +++ b/application/Espo/Tools/App/AppService.php @@ -168,8 +168,7 @@ class AppService $obj = $this->injectableFactory->create($className); $itemParams = $obj->get(); - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("AppParam $paramKey: " . $e->getMessage(), ['exception' => $e]); continue; diff --git a/application/Espo/Tools/Attachment/Api/PostCopy.php b/application/Espo/Tools/Attachment/Api/PostCopy.php index cc4d2656fc..eaa5f395ee 100644 --- a/application/Espo/Tools/Attachment/Api/PostCopy.php +++ b/application/Espo/Tools/Attachment/Api/PostCopy.php @@ -65,8 +65,7 @@ class PostCopy 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/EmailTemplate/Placeholders/CurrentYear.php b/application/Espo/Tools/EmailTemplate/Placeholders/CurrentYear.php index 14a3ded9b0..82841dca23 100644 --- a/application/Espo/Tools/EmailTemplate/Placeholders/CurrentYear.php +++ b/application/Espo/Tools/EmailTemplate/Placeholders/CurrentYear.php @@ -50,8 +50,7 @@ class CurrentYear implements Placeholder { try { $now = new DateTime('now', new DateTimezone($this->config->get('timeZone'))); - } - catch (Exception $e) { + } catch (Exception $e) { throw new RuntimeException($e->getMessage()); } diff --git a/application/Espo/Tools/Export/Format/Xlsx/Processor.php b/application/Espo/Tools/Export/Format/Xlsx/Processor.php index 3c63f44136..910a520fe4 100644 --- a/application/Espo/Tools/Export/Format/Xlsx/Processor.php +++ b/application/Espo/Tools/Export/Format/Xlsx/Processor.php @@ -64,8 +64,7 @@ class Processor implements ProcessorInterface { try { return $this->phpSpreadsheetProcessor->process($params, $collection); - } - catch (SpreadsheetException|WriterException $e) { + } catch (SpreadsheetException|WriterException $e) { throw new Error($e->getMessage()); } } @@ -77,8 +76,7 @@ class Processor implements ProcessorInterface { try { return $this->openSpoutProcessor->process($params, $collection); - } - catch (\Throwable $e) { + } catch (\Throwable $e) { throw new Error($e->getMessage()); } } diff --git a/application/Espo/Tools/Pdf/Dompdf/ImageSourceProvider.php b/application/Espo/Tools/Pdf/Dompdf/ImageSourceProvider.php index 2a6681f1b7..e36c772b8f 100644 --- a/application/Espo/Tools/Pdf/Dompdf/ImageSourceProvider.php +++ b/application/Espo/Tools/Pdf/Dompdf/ImageSourceProvider.php @@ -54,8 +54,7 @@ class ImageSourceProvider try { $this->checker->checkTypeImage($attachment); - } - catch (Forbidden) { + } catch (Forbidden) { return null; } diff --git a/tests/integration/Core/DataLoader.php b/tests/integration/Core/DataLoader.php index dedc4e19d6..33c7a1d3a0 100644 --- a/tests/integration/Core/DataLoader.php +++ b/tests/integration/Core/DataLoader.php @@ -100,8 +100,7 @@ class DataLoader $fileManager = $this->getContainer()->getByClass(FileManager::class); $fileManager->copy($path, '.', true); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Error loadFiles: ' . $e->getMessage()); } } @@ -128,8 +127,7 @@ class DataLoader try { $entityManager->saveEntity($entity); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Error loadEntities: ' . $e->getMessage() . ', ' . print_r($entityData, true)); } } @@ -147,8 +145,7 @@ class DataLoader try { $config->save(); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Error loadConfig: ' . $e->getMessage()); } } @@ -165,8 +162,7 @@ class DataLoader try { $entityManager->saveEntity($preferences); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Error loadPreferences: ' . $e->getMessage()); } } @@ -187,8 +183,7 @@ class DataLoader foreach ($data as $sql) { try { $pdo->query($sql); - } - catch (Exception $e) { + } catch (Exception $e) { throw new Exception('Error loadSql: ' . $e->getMessage() . ', sql: ' . $sql); } } diff --git a/tests/integration/Espo/Portal/AclTest.php b/tests/integration/Espo/Portal/AclTest.php index 11e312b477..9cb908ed9f 100644 --- a/tests/integration/Espo/Portal/AclTest.php +++ b/tests/integration/Espo/Portal/AclTest.php @@ -315,8 +315,7 @@ class AclTest extends BaseTestCase 'contactId' => $contactNotOwn->getId(), 'contactsIds' => [$contactNotOwn->getId()], ], CreateParams::create()); - } - catch (Forbidden) { + } catch (Forbidden) { $isThrown = true; } diff --git a/tests/integration/Espo/User/AclTest.php b/tests/integration/Espo/User/AclTest.php index 2a1093f51c..daf762f6b0 100644 --- a/tests/integration/Espo/User/AclTest.php +++ b/tests/integration/Espo/User/AclTest.php @@ -211,8 +211,7 @@ class AclTest extends \tests\integration\Core\BaseTestCase try { $processor->process('User', 'update', $request, $response); - } - catch (Exception $e) {}; + } catch (Exception $e) {}; $params = [ 'id' => $user1->getId(),