Skip to content

EspoCRM – Open Source CRM Application

fix exceptions

Yurii9f87a53f3823
diff --git a/application/Espo/Entities/CurrencyRecordRate.php b/application/Espo/Entities/CurrencyRecordRate.php
index ba04c5bb58..95144d08c2 100644
--- a/application/Espo/Entities/CurrencyRecordRate.php
+++ b/application/Espo/Entities/CurrencyRecordRate.php
@@ -31,7 +31,7 @@ namespace Espo\Entities;
use Espo\Core\Field\Date;
use Espo\Core\ORM\Entity;
-use ValueError;
+use UnexpectedValueException;
class CurrencyRecordRate extends Entity
{
@@ -81,7 +81,7 @@ class CurrencyRecordRate extends Entity
$record = $this->relations->getOne(self::FIELD_RECORD);
if (!$record instanceof CurrencyRecord) {
- throw new ValueError("No record.");
+ throw new UnexpectedValueException("No record.");
}
return $record;
@@ -92,7 +92,7 @@ class CurrencyRecordRate extends Entity
$date = $this->getValueObject(self::FIELD_DATE);
if (!$date instanceof Date) {
- throw new ValueError("No date.");
+ throw new UnexpectedValueException("No date.");
}
return $date;
diff --git a/application/Espo/Entities/OAuthAccount.php b/application/Espo/Entities/OAuthAccount.php
index 28ef91e84b..7eeffb1471 100644
--- a/application/Espo/Entities/OAuthAccount.php
+++ b/application/Espo/Entities/OAuthAccount.php
@@ -34,18 +34,18 @@ namespace Espo\Entities;
use Espo\Core\Field\DateTime;
use Espo\Core\ORM\Entity;
use SensitiveParameter;
-use ValueError;
+use UnexpectedValueException;
class OAuthAccount extends Entity
{
- public const ENTITY_TYPE = 'OAuthAccount';
+ public const string ENTITY_TYPE = 'OAuthAccount';
public function getProvider(): OAuthProvider
{
$provider = $this->relations->getOne('provider');
if (!$provider instanceof OAuthProvider) {
- throw new ValueError("No provider.");
+ throw new UnexpectedValueException("No provider.");
}
return $provider;
diff --git a/application/Espo/Entities/OAuthProvider.php b/application/Espo/Entities/OAuthProvider.php
index b931b49514..fa5ce8c951 100644
--- a/application/Espo/Entities/OAuthProvider.php
+++ b/application/Espo/Entities/OAuthProvider.php
@@ -33,11 +33,11 @@ namespace Espo\Entities;
use Espo\Core\ORM\Entity;
use stdClass;
-use ValueError;
+use UnexpectedValueException;
class OAuthProvider extends Entity
{
- public const ENTITY_TYPE = 'OAuthProvider';
+ public const string ENTITY_TYPE = 'OAuthProvider';
public function isActive(): bool
{
@@ -49,7 +49,7 @@ class OAuthProvider extends Entity
$value = $this->get('clientId');
if (!is_string($value)) {
- throw new ValueError("No client ID.");
+ throw new UnexpectedValueException("No client ID.");
}
return $value;
@@ -60,7 +60,7 @@ class OAuthProvider extends Entity
$value = $this->get('clientSecret');
if (!is_string($value)) {
- throw new ValueError("No client secret.");
+ throw new UnexpectedValueException("No client secret.");
}
return $value;
@@ -71,7 +71,7 @@ class OAuthProvider extends Entity
$value = $this->get('tokenEndpoint');
if (!is_string($value)) {
- throw new ValueError("No token endpoint.");
+ throw new UnexpectedValueException("No token endpoint.");
}
return $value;
@@ -82,7 +82,7 @@ class OAuthProvider extends Entity
$value = $this->get('authorizationEndpoint');
if (!is_string($value)) {
- throw new ValueError("No authorization endpoint.");
+ throw new UnexpectedValueException("No authorization endpoint.");
}
return $value;