add throws
This commit is contained in:
@@ -168,6 +168,7 @@ class Admin
|
||||
|
||||
/**
|
||||
* @return array<int,array{id:string,type:string,message:string}>
|
||||
* @throws \Espo\Core\Exceptions\Error
|
||||
*/
|
||||
public function actionAdminNotificationList(): array
|
||||
{
|
||||
|
||||
@@ -65,8 +65,10 @@ class ActionFactory
|
||||
|
||||
/**
|
||||
* @param array<string,object> $with
|
||||
* @deprecated
|
||||
* @throws NotFound
|
||||
* @throws Forbidden
|
||||
* @todo Remove.
|
||||
* @deprecated
|
||||
*/
|
||||
public function createWith(string $action, ?string $entityType, array $with): Action
|
||||
{
|
||||
|
||||
@@ -269,6 +269,7 @@ class Auth
|
||||
|
||||
/**
|
||||
* @return array{?string,?string}
|
||||
* @throws BadRequest
|
||||
*/
|
||||
protected function obtainUsernamePasswordFromRequest(Request $request): array
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Get a portal ID (if an application is portal).
|
||||
* @throws Error
|
||||
*/
|
||||
public function getPortalId(): string
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Get a portal entity (if an application is portal).
|
||||
* @throws Error
|
||||
*/
|
||||
public function getPortal(): PortalEntity
|
||||
{
|
||||
@@ -88,6 +90,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Get a current logged user. If no auth is applied, then the system user will be returned.
|
||||
* @throws Error
|
||||
*/
|
||||
public function getUser(): UserEntity
|
||||
{
|
||||
@@ -101,6 +104,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Get an ID of a current logged user. If no auth is applied, then the system user will be returned.
|
||||
* @throws Error
|
||||
*/
|
||||
public function getUserId(): string
|
||||
{
|
||||
@@ -109,6 +113,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Whether a user is logged.
|
||||
* @throws Error
|
||||
*/
|
||||
public function isLogged(): bool
|
||||
{
|
||||
@@ -125,6 +130,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Whether logged as an admin.
|
||||
* @throws Error
|
||||
*/
|
||||
public function isAdmin(): bool
|
||||
{
|
||||
@@ -138,6 +144,7 @@ class ApplicationState
|
||||
|
||||
/**
|
||||
* Whether logged as an API user.
|
||||
* @throws Error
|
||||
*/
|
||||
public function isApi(): bool
|
||||
{
|
||||
|
||||
@@ -105,7 +105,8 @@ abstract class Base
|
||||
protected $serviceFactory;
|
||||
|
||||
/**
|
||||
* @internal Most of dependencies are for backward compatibility.
|
||||
* @throws Forbidden
|
||||
* @internal Most dependencies are for backward compatibility.
|
||||
*/
|
||||
public function __construct(
|
||||
Container $container,
|
||||
|
||||
@@ -67,6 +67,7 @@ class Argument implements Evaluatable
|
||||
|
||||
/**
|
||||
* Get a nested argument list.
|
||||
* @throws Error
|
||||
*/
|
||||
public function getArgumentList(): ArgumentList
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ class AttributeType extends Base
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws Error
|
||||
*/
|
||||
public function process(\stdClass $item)
|
||||
{
|
||||
@@ -62,6 +63,7 @@ class AttributeType extends Base
|
||||
/**
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
* @throws Error
|
||||
*/
|
||||
protected function getAttributeValue($attribute)
|
||||
{
|
||||
|
||||
@@ -132,6 +132,7 @@ abstract class Base implements Injectable
|
||||
/**
|
||||
* @param mixed $item
|
||||
* @return mixed
|
||||
* @throws \Espo\Core\Formula\Exceptions\Error
|
||||
*/
|
||||
protected function evaluate($item)
|
||||
{
|
||||
|
||||
@@ -98,6 +98,7 @@ abstract class BaseFunction
|
||||
*
|
||||
* @param Evaluatable $item Argument or ArgumentList.
|
||||
* @return mixed A result of evaluation. An array if an argument list was passed.
|
||||
* @throws Error
|
||||
*/
|
||||
protected function evaluate(Evaluatable $item)
|
||||
{
|
||||
@@ -108,6 +109,7 @@ abstract class BaseFunction
|
||||
* Throws TooFewArguments exception.
|
||||
*
|
||||
* @return never
|
||||
* @throws TooFewArguments
|
||||
*/
|
||||
protected function throwTooFewArguments(?int $number = null)
|
||||
{
|
||||
@@ -124,6 +126,7 @@ abstract class BaseFunction
|
||||
* Throw BadArgumentType exception.
|
||||
*
|
||||
* @return never
|
||||
* @throws BadArgumentType
|
||||
*/
|
||||
protected function throwBadArgumentType(?int $index = null, ?string $type = null)
|
||||
{
|
||||
@@ -144,6 +147,7 @@ abstract class BaseFunction
|
||||
* Throw BadArgumentValue exception.
|
||||
*
|
||||
* @return never
|
||||
* @throws BadArgumentValue
|
||||
*/
|
||||
protected function throwBadArgumentValue(?int $index = null, ?string $msg = null)
|
||||
{
|
||||
@@ -164,6 +168,7 @@ abstract class BaseFunction
|
||||
* Throw Error exception.
|
||||
*
|
||||
* @return never
|
||||
* @throws Error
|
||||
*/
|
||||
protected function throwError(?string $msg = null)
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ abstract class Base extends BaseFunction
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Espo\Core\Formula\Exceptions\TooFewArguments
|
||||
*/
|
||||
public function process(ArgumentList $args)
|
||||
{
|
||||
|
||||
@@ -311,6 +311,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws Error
|
||||
*/
|
||||
protected function getProcessId()
|
||||
{
|
||||
@@ -408,6 +409,7 @@ abstract class Base
|
||||
* @param string $currentVersion
|
||||
* @param string $errorMessage
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
public function checkVersions($versionList, $currentVersion, $errorMessage = '')
|
||||
{
|
||||
@@ -448,6 +450,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
protected function checkPackageType()
|
||||
{
|
||||
@@ -498,6 +501,7 @@ abstract class Base
|
||||
* Run a script by a type.
|
||||
* @param string $type Ex. "before", "after".
|
||||
* @return void
|
||||
* @throws Error
|
||||
*/
|
||||
protected function runScript($type)
|
||||
{
|
||||
@@ -553,6 +557,7 @@ abstract class Base
|
||||
* @param string $name
|
||||
* @param bool $isPackage
|
||||
* @return string
|
||||
* @throws Error
|
||||
*/
|
||||
protected function getPath($name = 'packagePath', $isPackage = false)
|
||||
{
|
||||
@@ -640,6 +645,7 @@ abstract class Base
|
||||
* @param string $type
|
||||
* @param bool $withEmptyDirs
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
protected function deleteFiles($type = 'delete', $withEmptyDirs = false)
|
||||
{
|
||||
@@ -744,6 +750,7 @@ abstract class Base
|
||||
* @param string[] $fileList
|
||||
* @param bool $copyOnlyFiles
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
protected function copy(
|
||||
$sourcePath,
|
||||
@@ -874,6 +881,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws Error
|
||||
*/
|
||||
public function getManifest()
|
||||
{
|
||||
@@ -952,6 +960,7 @@ abstract class Base
|
||||
*
|
||||
* @param ?string $packagePath
|
||||
* @return void
|
||||
* @throws Error
|
||||
*/
|
||||
protected function unzipArchive($packagePath = null)
|
||||
{
|
||||
@@ -1026,6 +1035,7 @@ abstract class Base
|
||||
* @param string $actionName
|
||||
* @param string|array<string,mixed> $data
|
||||
* @return void
|
||||
* @throws Error
|
||||
*/
|
||||
protected function executeAction($actionName, $data)
|
||||
{
|
||||
@@ -1069,6 +1079,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Error
|
||||
*/
|
||||
protected function clearCache()
|
||||
{
|
||||
@@ -1080,6 +1091,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws Error
|
||||
*/
|
||||
protected function checkIsWritable()
|
||||
{
|
||||
@@ -1101,6 +1113,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
protected function backupExistingFiles()
|
||||
{
|
||||
@@ -1248,6 +1261,7 @@ abstract class Base
|
||||
/**
|
||||
* @param bool $isParentProcess
|
||||
* @return ?string
|
||||
* @throws Error
|
||||
*/
|
||||
protected function getTemporaryConfigParamName($isParentProcess = false)
|
||||
{
|
||||
|
||||
@@ -89,6 +89,7 @@ abstract class Base
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws Error
|
||||
*/
|
||||
public function getManifest()
|
||||
{
|
||||
@@ -98,6 +99,7 @@ abstract class Base
|
||||
/**
|
||||
* @param string $processId
|
||||
* @return array<string,mixed>
|
||||
* @throws Error
|
||||
*/
|
||||
public function getManifestById($processId)
|
||||
{
|
||||
@@ -110,6 +112,7 @@ abstract class Base
|
||||
/**
|
||||
* @param string $data
|
||||
* @return string
|
||||
* @throws Error
|
||||
*/
|
||||
public function upload($data)
|
||||
{
|
||||
@@ -121,6 +124,7 @@ abstract class Base
|
||||
/**
|
||||
* @param array<string,mixed> $data
|
||||
* @return mixed
|
||||
* @throws Error
|
||||
*/
|
||||
public function install($data)
|
||||
{
|
||||
@@ -132,6 +136,7 @@ abstract class Base
|
||||
/**
|
||||
* @param array<string,mixed> $data
|
||||
* @return mixed
|
||||
* @throws Error
|
||||
*/
|
||||
public function uninstall($data)
|
||||
{
|
||||
@@ -143,6 +148,7 @@ abstract class Base
|
||||
/**
|
||||
* @param array<string,mixed> $data
|
||||
* @return mixed
|
||||
* @throws Error
|
||||
*/
|
||||
public function delete($data)
|
||||
{
|
||||
@@ -155,6 +161,7 @@ abstract class Base
|
||||
* @param string $stepName
|
||||
* @param array<string,mixed> $params
|
||||
* @return bool
|
||||
* @throws Error
|
||||
*/
|
||||
public function runInstallStep($stepName, array $params = [])
|
||||
{
|
||||
|
||||
@@ -139,6 +139,7 @@ class Autoload
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
* @throws \JsonException
|
||||
*/
|
||||
private function loadDataFromFile(string $filePath): array
|
||||
{
|
||||
|
||||
@@ -201,6 +201,7 @@ class Activities
|
||||
|
||||
/**
|
||||
* @return array<int,array<string,mixed>>
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getActionPopupNotifications(): array
|
||||
{
|
||||
|
||||
@@ -41,6 +41,8 @@ class CaseObj extends \Espo\Core\Controllers\Record
|
||||
|
||||
/**
|
||||
* @return \stdClass[]
|
||||
* @throws BadRequest
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getActionEmailAddressList(Request $request): array
|
||||
{
|
||||
|
||||
@@ -991,6 +991,7 @@ class Activities implements
|
||||
* }
|
||||
* @throws NotFound
|
||||
* @throws Error
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getHistory(string $scope, string $id, array $params = []): array
|
||||
{
|
||||
@@ -1713,6 +1714,7 @@ class Activities implements
|
||||
* @param ?array<int,array<string,mixed>> $ignoreEventList
|
||||
* @return stdClass[]
|
||||
* @throws NotFound
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getBusyRangeList(
|
||||
string $userId,
|
||||
@@ -1900,6 +1902,7 @@ class Activities implements
|
||||
* @param ?string[] $scopeList
|
||||
* @return array<int,array<string,mixed>>
|
||||
* @throws NotFound
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function getEvents(
|
||||
string $userId,
|
||||
@@ -2020,6 +2023,7 @@ class Activities implements
|
||||
* list: stdClass[],
|
||||
* }
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
*/
|
||||
public function getUpcomingActivities(
|
||||
string $userId,
|
||||
|
||||
@@ -88,6 +88,7 @@ class CaseObj extends Record
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
* @throws \Espo\Core\Exceptions\ForbiddenSilent
|
||||
*/
|
||||
public function getEmailAddressList(string $id): array
|
||||
{
|
||||
|
||||
@@ -502,6 +502,7 @@ class BaseEntity implements Entity
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function prepareAttributeValue(string $attribute, $value)
|
||||
{
|
||||
@@ -566,6 +567,7 @@ class BaseEntity implements Entity
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @throws \JsonException
|
||||
*/
|
||||
private function prepareObjectAttributeValue($value): ?stdClass
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ class BasePlusType implements Di\ConfigAware, Di\MetadataAware
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $params
|
||||
* @throws \Espo\Core\Exceptions\Error
|
||||
*/
|
||||
public function afterCreate(string $name, $params): void
|
||||
{
|
||||
@@ -105,4 +106,4 @@ class BasePlusType implements Di\ConfigAware, Di\MetadataAware
|
||||
|
||||
$this->metadata->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class AutoincrementType implements Di\MetadataAware
|
||||
/**
|
||||
* @param array<string,mixed> $defs
|
||||
* @param array<string,mixed> $options
|
||||
* @throws Error
|
||||
*/
|
||||
public function beforeSave(string $scope, string $name, $defs, $options): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user