diff --git a/application/Espo/Controllers/Admin.php b/application/Espo/Controllers/Admin.php index 05042357c7..e06c3024d1 100644 --- a/application/Espo/Controllers/Admin.php +++ b/application/Espo/Controllers/Admin.php @@ -96,12 +96,26 @@ class Admin return true; } + /** + * @return string[] + */ public function getActionJobs(): array { return $this->scheduledJob->getAvailableList(); } - public function postActionUploadUpgradePackage($params, $data) + + /** + * @todo Use Request. + * + * @param array $params + * @param string $data + * @return array{ + * id: string, + * version: string, + * } + */ + public function postActionUploadUpgradePackage($params, $data): array { if ($this->config->get('restrictedMode')) { if (!$this->user->isSuperAdmin()) { @@ -137,16 +151,32 @@ class Admin return true; } + /** + * @return array{ + * message: string, + * command: string, + * } + */ public function actionCronMessage(): array { return $this->scheduledJob->getSetupMessage(); } + /** + * @return array + */ public function actionAdminNotificationList(): array { return $this->adminNotificationManager->getNotificationList(); } + /** + * @return array{ + * php: array>, + * database: array>, + * permission: array, + * } + */ public function actionSystemRequirementList(): array { return $this->systemRequirements->getAllRequiredList(); diff --git a/application/Espo/Controllers/Email.php b/application/Espo/Controllers/Email.php index 0a3a6d716c..0eece929a4 100644 --- a/application/Espo/Controllers/Email.php +++ b/application/Espo/Controllers/Email.php @@ -61,7 +61,7 @@ class Email extends Record /** * @todo Move to service. */ - public function postActionSendTestEmail(Request $request) + public function postActionSendTestEmail(Request $request): bool { $data = $request->getParsedBody(); @@ -142,10 +142,12 @@ class Email extends Record } } - return $this->getEmailService()->sendTestEmail(get_object_vars($data)); + $this->getEmailService()->sendTestEmail(get_object_vars($data)); + + return true; } - public function postActionMarkAsRead(Request $request) + public function postActionMarkAsRead(Request $request): bool { $data = $request->getParsedBody(); @@ -161,7 +163,9 @@ class Email extends Record } } - return $this->getEmailService()->markAsReadByIdList($idList); + $this->getEmailService()->markAsReadByIdList($idList); + + return true; } public function postActionMarkAsNotRead(Request $request): bool @@ -304,7 +308,7 @@ class Email extends Record return true; } - public function getActionGetInsertFieldData(Request $request) + public function getActionGetInsertFieldData(Request $request): stdClass { if (!$this->acl->checkScope('Email', 'create')) { throw new Forbidden(); diff --git a/application/Espo/Controllers/EmailAddress.php b/application/Espo/Controllers/EmailAddress.php index 81b047966d..e39a2aff2b 100644 --- a/application/Espo/Controllers/EmailAddress.php +++ b/application/Espo/Controllers/EmailAddress.php @@ -40,6 +40,9 @@ use Espo\Core\{ class EmailAddress extends RecordBase { + /** + * @return array> + */ public function actionSearchInAddressBook(Request $request): array { if (!$this->acl->checkScope('Email')) { diff --git a/application/Espo/Controllers/EmailFolder.php b/application/Espo/Controllers/EmailFolder.php index 4f335914de..49c89134ba 100644 --- a/application/Espo/Controllers/EmailFolder.php +++ b/application/Espo/Controllers/EmailFolder.php @@ -66,6 +66,11 @@ class EmailFolder extends RecordBase return true; } + /** + * @return array{ + * list:array> + * } + */ public function getActionListAll(): array { return $this->getEmailFolderService()->listAll(); diff --git a/application/Espo/Controllers/ExternalAccount.php b/application/Espo/Controllers/ExternalAccount.php index d6e93ded74..925a851255 100644 --- a/application/Espo/Controllers/ExternalAccount.php +++ b/application/Espo/Controllers/ExternalAccount.php @@ -142,7 +142,7 @@ class ExternalAccount extends RecordBase return $entity->getValueMap(); } - public function postActionAuthorizationCode(Request $request) + public function postActionAuthorizationCode(Request $request): bool { $data = $request->getParsedBody(); @@ -155,7 +155,9 @@ class ExternalAccount extends RecordBase throw new Forbidden(); } - return $this->getExternalAccount()->authorizationCode($integration, $userId, $code); + $this->getExternalAccount()->authorizationCode($integration, $userId, $code); + + return true; } private function getExternalAccount(): Service diff --git a/application/Espo/Controllers/FieldManager.php b/application/Espo/Controllers/FieldManager.php index 6934d69232..0cb103a6a2 100644 --- a/application/Espo/Controllers/FieldManager.php +++ b/application/Espo/Controllers/FieldManager.php @@ -44,11 +44,11 @@ use Espo\Core\{ class FieldManager { - protected $user; + private $user; - protected $dataManager; + private $dataManager; - protected $fieldManagerTool; + private $fieldManagerTool; public function __construct(User $user, DataManager $dataManager, FieldManagerTool $fieldManagerTool) { @@ -59,14 +59,17 @@ class FieldManager $this->checkControllerAccess(); } - protected function checkControllerAccess() + protected function checkControllerAccess(): void { if (!$this->user->isAdmin()) { throw new Forbidden(); } } - public function getActionRead(Request $request) + /** + * @return array + */ + public function getActionRead(Request $request): array { $scope = $request->getRouteParam('scope'); $name = $request->getRouteParam('name'); @@ -75,16 +78,13 @@ class FieldManager throw new BadRequest(); } - $data = $this->fieldManagerTool->read($scope, $name); - - if (!isset($data)) { - throw new BadRequest(); - } - - return $data; + return $this->fieldManagerTool->read($scope, $name); } - public function postActionCreate(Request $request) + /** + * @return array + */ + public function postActionCreate(Request $request): array { $data = $request->getParsedBody(); @@ -111,12 +111,18 @@ class FieldManager return $fieldManagerTool->read($scope, $data->name); } - public function patchActionUpdate(Request $request) + /** + * @return array + */ + public function patchActionUpdate(Request $request): array { return $this->putActionUpdate($request); } - public function putActionUpdate(Request $request) + /** + * @return array + */ + public function putActionUpdate(Request $request): array { $data = $request->getParsedBody(); @@ -140,7 +146,7 @@ class FieldManager return $fieldManagerTool->read($scope, $name); } - public function deleteActionDelete(Request $request) + public function deleteActionDelete(Request $request): bool { $scope = $request->getRouteParam('scope'); $name = $request->getRouteParam('name'); @@ -156,7 +162,7 @@ class FieldManager return $result; } - public function postActionResetToDefault(Request $request) + public function postActionResetToDefault(Request $request): bool { $data = $request->getParsedBody(); diff --git a/application/Espo/Controllers/I18n.php b/application/Espo/Controllers/I18n.php index 4ff6658688..19b40eca07 100644 --- a/application/Espo/Controllers/I18n.php +++ b/application/Espo/Controllers/I18n.php @@ -42,6 +42,9 @@ class I18n $this->service = $service; } + /** + * @return array + */ public function getActionRead(Request $request): array { $default = $request->getQueryParam('default') === 'true'; diff --git a/application/Espo/Controllers/LeadCapture.php b/application/Espo/Controllers/LeadCapture.php index 0ead5563ed..c82849a751 100644 --- a/application/Espo/Controllers/LeadCapture.php +++ b/application/Espo/Controllers/LeadCapture.php @@ -97,6 +97,9 @@ class LeadCapture extends Record ->getValueMap(); } + /** + * @return stdClass[] + */ public function getActionSmtpAccountDataList(): array { if (!$this->getUser()->isAdmin()) { diff --git a/application/Espo/Controllers/MassAction.php b/application/Espo/Controllers/MassAction.php index dffe5cb5ea..d098322997 100644 --- a/application/Espo/Controllers/MassAction.php +++ b/application/Espo/Controllers/MassAction.php @@ -115,6 +115,9 @@ class MassAction $response->writeBody('true'); } + /** + * @return array + */ private function prepareMassActionParams(stdClass $data): array { $where = $data->where ?? null; diff --git a/application/Espo/Controllers/Metadata.php b/application/Espo/Controllers/Metadata.php index 4577c37105..463832bb77 100644 --- a/application/Espo/Controllers/Metadata.php +++ b/application/Espo/Controllers/Metadata.php @@ -47,6 +47,9 @@ class Metadata extends Base return $this->getMetadataService()->getDataForFrontend(); } + /** + * @return mixed + */ public function getActionGet(Request $request) { if (!$this->user->isAdmin()) { diff --git a/application/Espo/Controllers/Stream.php b/application/Espo/Controllers/Stream.php index 2277a4acd7..ae1644519a 100644 --- a/application/Espo/Controllers/Stream.php +++ b/application/Espo/Controllers/Stream.php @@ -40,7 +40,7 @@ use stdClass; class Stream { - public static $defaultAction = 'list'; + public static string $defaultAction = 'list'; private $service; diff --git a/application/Espo/Core/Controllers/RecordTree.php b/application/Espo/Core/Controllers/RecordTree.php index d24744dbed..e489a92b10 100644 --- a/application/Espo/Core/Controllers/RecordTree.php +++ b/application/Espo/Core/Controllers/RecordTree.php @@ -92,6 +92,9 @@ class RecordTree extends Record return $this->getRecordTreeService()->getLastChildrenIdList($parentId); } + /** + * @return Service<\Espo\Core\ORM\Entity> + */ protected function getRecordTreeService(): Service { $service = $this->getRecordService(); diff --git a/application/Espo/Core/Di/AclSetter.php b/application/Espo/Core/Di/AclSetter.php index ef83ddd56b..88b1bb9fc5 100644 --- a/application/Espo/Core/Di/AclSetter.php +++ b/application/Espo/Core/Di/AclSetter.php @@ -33,7 +33,7 @@ use Espo\Core\Acl; trait AclSetter { - /* + /** * @var Acl */ protected $acl; diff --git a/application/Espo/Core/Di/SelectManagerFactorySetter.php b/application/Espo/Core/Di/SelectManagerFactorySetter.php index c7f68b0e95..6a4392d03e 100644 --- a/application/Espo/Core/Di/SelectManagerFactorySetter.php +++ b/application/Espo/Core/Di/SelectManagerFactorySetter.php @@ -33,6 +33,9 @@ use Espo\Core\Select\SelectManagerFactory; trait SelectManagerFactorySetter { + /** + * @var SelectManagerFactory + */ protected $selectManagerFactory; public function setSelectManagerFactory(SelectManagerFactory $selectManagerFactory): void diff --git a/application/Espo/Core/Templates/Services/Base.php b/application/Espo/Core/Templates/Services/Base.php index 874db22de2..73d4765e12 100644 --- a/application/Espo/Core/Templates/Services/Base.php +++ b/application/Espo/Core/Templates/Services/Base.php @@ -29,9 +29,9 @@ namespace Espo\Core\Templates\Services; - +/** + * @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Base> + */ class Base extends \Espo\Services\Record { - } - diff --git a/application/Espo/Core/Templates/Services/BasePlus.php b/application/Espo/Core/Templates/Services/BasePlus.php index 67511479b8..8a8dc4b1ee 100644 --- a/application/Espo/Core/Templates/Services/BasePlus.php +++ b/application/Espo/Core/Templates/Services/BasePlus.php @@ -29,9 +29,9 @@ namespace Espo\Core\Templates\Services; - +/** + * @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\BasePlus> + */ class BasePlus extends \Espo\Services\Record { - } - diff --git a/application/Espo/Core/Templates/Services/CategoryTree.php b/application/Espo/Core/Templates/Services/CategoryTree.php index 632ec96f5f..9e191254b0 100644 --- a/application/Espo/Core/Templates/Services/CategoryTree.php +++ b/application/Espo/Core/Templates/Services/CategoryTree.php @@ -29,9 +29,10 @@ namespace Espo\Core\Templates\Services; - +/** + * @extends \Espo\Services\RecordTree<\Espo\Core\Templates\Entities\CategoryTree> + */ class CategoryTree extends \Espo\Services\RecordTree { } - diff --git a/application/Espo/Core/Templates/Services/Company.php b/application/Espo/Core/Templates/Services/Company.php index 5ca71dab3b..a5ef413a7d 100644 --- a/application/Espo/Core/Templates/Services/Company.php +++ b/application/Espo/Core/Templates/Services/Company.php @@ -29,6 +29,9 @@ namespace Espo\Core\Templates\Services; +/** + * @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Company> + */ class Company extends \Espo\Services\Record { } diff --git a/application/Espo/Core/Templates/Services/Event.php b/application/Espo/Core/Templates/Services/Event.php index 1f14c998f2..d271fd47c3 100644 --- a/application/Espo/Core/Templates/Services/Event.php +++ b/application/Espo/Core/Templates/Services/Event.php @@ -29,6 +29,9 @@ namespace Espo\Core\Templates\Services; +/** + * @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Event> + */ class Event extends \Espo\Services\Record { protected $validateRequiredSkipFieldList = [ diff --git a/application/Espo/Core/Templates/Services/Person.php b/application/Espo/Core/Templates/Services/Person.php index 3265d4cdbf..e7fc3ac7a1 100644 --- a/application/Espo/Core/Templates/Services/Person.php +++ b/application/Espo/Core/Templates/Services/Person.php @@ -29,6 +29,9 @@ namespace Espo\Core\Templates\Services; +/** + * @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Person> + */ class Person extends \Espo\Services\Record { diff --git a/application/Espo/Core/Traits/Injectable.php b/application/Espo/Core/Traits/Injectable.php index 990f5e0ed7..81c210d866 100644 --- a/application/Espo/Core/Traits/Injectable.php +++ b/application/Espo/Core/Traits/Injectable.php @@ -34,27 +34,45 @@ trait Injectable { protected $injections = []; /** @phpstan-ignore-line */ + /** + * @param string $name + * @param object $object + * @return void + */ public function inject($name, $object) { $this->injections[$name] = $object; } - public function getDependencyList() : array /** @phpstan-ignore-line */ + /** + * @return string[] + */ + public function getDependencyList(): array { return $this->dependencyList; } - protected function getInjection(string $name) /** @phpstan-ignore-line */ + /** + * @return ?object + */ + protected function getInjection(string $name) { return $this->injections[$name] ?? $this->$name ?? null; } - protected function addDependency(string $name) /** @phpstan-ignore-line */ + /** + * @return void + */ + protected function addDependency(string $name) { $this->dependencyList[] = $name; } - protected function addDependencyList(array $list) /** @phpstan-ignore-line */ + /** + * @param string[] $list + * @return void + */ + protected function addDependencyList(array $list) { foreach ($list as $item) { $this->addDependency($item); diff --git a/application/Espo/Core/Utils/AdminNotificationManager.php b/application/Espo/Core/Utils/AdminNotificationManager.php index 6f75d8e035..e076ede206 100644 --- a/application/Espo/Core/Utils/AdminNotificationManager.php +++ b/application/Espo/Core/Utils/AdminNotificationManager.php @@ -63,7 +63,6 @@ class AdminNotificationManager } /** - * * @return array */ public function getNotificationList(): array diff --git a/application/Espo/Entities/Email.php b/application/Espo/Entities/Email.php index 97f86e992e..3f6dae31cb 100644 --- a/application/Espo/Entities/Email.php +++ b/application/Espo/Entities/Email.php @@ -54,42 +54,46 @@ class Email extends Entity public const STATUS_DRAFT = 'Draft'; - protected function _getSubject() + protected function _getSubject(): ?string { return $this->get('name'); } - protected function _setSubject($value) + protected function _setSubject(?string $value): void { $this->set('name', $value); } - protected function _hasSubject() + /** + * @return bool + */ + protected function _hasSubject(): bool { return $this->has('name'); } - protected function _hasFromName() + + protected function _hasFromName(): bool { return $this->has('fromString'); } - protected function _hasFromAddress() + protected function _hasFromAddress(): bool { return $this->has('fromString'); } - protected function _hasReplyToName() + protected function _hasReplyToName(): bool { return $this->has('replyToString'); } - protected function _hasReplyToAddress() + protected function _hasReplyToAddress(): bool { return $this->has('replyToString'); } - protected function _getFromName() + protected function _getFromName(): ?string { if (!$this->has('fromString')) { return null; @@ -104,7 +108,7 @@ class Email extends Entity return $string; } - protected function _getFromAddress() + protected function _getFromAddress(): ?string { if (!$this->has('fromString')) { return null; @@ -113,7 +117,7 @@ class Email extends Entity return EmailService::parseFromAddress($this->get('fromString')); } - protected function _getReplyToName() + protected function _getReplyToName(): ?string { if (!$this->has('replyToString')) { return null; @@ -130,7 +134,7 @@ class Email extends Entity ); } - protected function _getReplyToAddress() + protected function _getReplyToAddress(): ?string { if (!$this->has('replyToString')) { return null; @@ -147,7 +151,7 @@ class Email extends Entity ); } - protected function _setIsRead($value) + protected function _setIsRead(?bool $value): void { $this->setInContainer('isRead', $value !== false); @@ -177,7 +181,7 @@ class Email extends Entity $this->entityManager->saveEntity($attachment); } - protected function _getBodyPlain() + protected function _getBodyPlain(): ?string { return $this->getBodyPlain(); } diff --git a/application/Espo/Entities/EmailAddress.php b/application/Espo/Entities/EmailAddress.php index 471da9b5da..c860016d80 100644 --- a/application/Espo/Entities/EmailAddress.php +++ b/application/Espo/Entities/EmailAddress.php @@ -37,6 +37,10 @@ class EmailAddress extends Entity { public const ENTITY_TYPE = 'EmailAddress'; + /** + * @param string $value + * @return void + */ protected function _setName($value) { if (empty($value)) { diff --git a/application/Espo/Entities/Import.php b/application/Espo/Entities/Import.php index 9b851f70be..6d62a3ba08 100644 --- a/application/Espo/Entities/Import.php +++ b/application/Espo/Entities/Import.php @@ -65,6 +65,9 @@ class Import extends \Espo\Core\ORM\Entity return $this->get('entityType'); } + /** + * @return ?string[] + */ public function getTargetAttributeList(): ?array { return $this->get('attributeList'); diff --git a/application/Espo/Entities/Note.php b/application/Espo/Entities/Note.php index 8303196679..59ee0354e3 100644 --- a/application/Espo/Entities/Note.php +++ b/application/Espo/Entities/Note.php @@ -57,7 +57,7 @@ class Note extends Entity public const TYPE_CREATE = 'Create'; - private $aclIsProcessed = false; + private bool $aclIsProcessed = false; public function isPost(): bool { @@ -174,7 +174,7 @@ class Note extends Entity $this->set('attachmentsTypes', $types); } - public function addNotifiedUserId($userId): void + public function addNotifiedUserId(string $userId): void { $userIdList = $this->get('notifiedUserIdList'); @@ -189,7 +189,7 @@ class Note extends Entity $this->set('notifiedUserIdList', $userIdList); } - public function isUserIdNotified($userId): bool + public function isUserIdNotified(string $userId): bool { $userIdList = $this->get('notifiedUserIdList') ?? []; diff --git a/application/Espo/Entities/PhoneNumber.php b/application/Espo/Entities/PhoneNumber.php index 357b647cd8..2643ed5391 100644 --- a/application/Espo/Entities/PhoneNumber.php +++ b/application/Espo/Entities/PhoneNumber.php @@ -37,6 +37,10 @@ class PhoneNumber extends Entity { public const ENTITY_TYPE = 'PhoneNumber'; + /** + * @param string $value + * @return void + */ protected function _setName($value) { if (empty($value)) { diff --git a/application/Espo/Entities/Portal.php b/application/Espo/Entities/Portal.php index 882ce2779a..2af3187ab5 100644 --- a/application/Espo/Entities/Portal.php +++ b/application/Espo/Entities/Portal.php @@ -33,6 +33,9 @@ class Portal extends \Espo\Core\ORM\Entity { public const ENTITY_TYPE = 'Portal'; + /** + * @var string[] + */ protected $settingsAttributeList = [ 'companyLogoId', 'tabList', @@ -48,6 +51,9 @@ class Portal extends \Espo\Core\ORM\Entity 'defaultCurrency', ]; + /** + * @return string[] + */ public function getSettingsAttributeList(): array { return $this->settingsAttributeList; diff --git a/application/Espo/Entities/Preferences.php b/application/Espo/Entities/Preferences.php index e37e0098ac..67e8f5d0c0 100644 --- a/application/Espo/Entities/Preferences.php +++ b/application/Espo/Entities/Preferences.php @@ -33,6 +33,9 @@ class Preferences extends \Espo\Core\ORM\Entity { public const ENTITY_TYPE = 'Preferences'; + /** + * @return ?array + */ public function getSmtpParams(): ?array { $smtpParams = []; diff --git a/application/Espo/Entities/User.php b/application/Espo/Entities/User.php index 3579b51a6b..e2239bd9ff 100644 --- a/application/Espo/Entities/User.php +++ b/application/Espo/Entities/User.php @@ -114,6 +114,9 @@ class User extends Person return $this->getValueObject('teams'); } + /** + * @return string[] + */ public function getTeamIdList(): array { return $this->getLinkMultipleIdList('teams'); @@ -169,6 +172,9 @@ class User extends Person return $this->get('userName'); } + /** + * @return ?string + */ protected function _getName() { if (!$this->hasInContainer('name') || !$this->getFromContainer('name')) { @@ -180,6 +186,9 @@ class User extends Person return $this->getFromContainer('name'); } + /** + * @return bool + */ protected function _hasName() { if ($this->hasInContainer('name')) { diff --git a/application/Espo/EntryPoints/Attachment.php b/application/Espo/EntryPoints/Attachment.php index 39b05662a0..35d8284140 100644 --- a/application/Espo/EntryPoints/Attachment.php +++ b/application/Espo/EntryPoints/Attachment.php @@ -107,6 +107,9 @@ class Attachment implements EntryPoint ->setBody($stream); } + /** + * @return string[] + */ private function getAllowedFileTypeList(): array { return $this->metadata->get(['app', 'image', 'allowedFileTypeList']) ?? []; diff --git a/application/Espo/EntryPoints/Avatar.php b/application/Espo/EntryPoints/Avatar.php index 106c422b5b..6ecfdfd8de 100644 --- a/application/Espo/EntryPoints/Avatar.php +++ b/application/Espo/EntryPoints/Avatar.php @@ -44,8 +44,11 @@ class Avatar extends Image implements Di\MetadataAware use Di\MetadataSetter; use NotStrictAuth; - protected $systemColor = '#a4b5bd'; + protected string $systemColor = '#a4b5bd'; + /** + * @var array + */ protected $colorList = [ [111, 168, 214], [237, 197, 85], @@ -58,7 +61,10 @@ class Avatar extends Image implements Di\MetadataAware '#E8AF64', ]; - protected function getColor($hash) + /** + * @return string|array{int,int,int} + */ + protected function getColor(string $hash) { $length = strlen($hash); diff --git a/application/Espo/EntryPoints/Download.php b/application/Espo/EntryPoints/Download.php index 3747f271f6..afa94d8caf 100644 --- a/application/Espo/EntryPoints/Download.php +++ b/application/Espo/EntryPoints/Download.php @@ -43,6 +43,9 @@ use Espo\Core\{ class Download implements EntryPoint { + /** + * @var string[] + */ protected $fileTypesToShowInline = [ 'application/pdf', 'application/vnd.ms-word', diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.php index 8d21210b27..21a59ff500 100644 --- a/application/Espo/EntryPoints/Image.php +++ b/application/Espo/EntryPoints/Image.php @@ -52,8 +52,14 @@ use Espo\Entities\Attachment; class Image implements EntryPoint { + /** + * @var ?string[] + */ protected $allowedRelatedTypeList = null; + /** + * @var ?string[] + */ protected $allowedFieldList = null; /** @var FileStorageManager */ @@ -228,6 +234,9 @@ class Image implements EntryPoint return $contents; } + /** + * @return resource|\GdImage + */ protected function createThumbImage(string $filePath, string $fileType, string $size) { if (!is_array(getimagesize($filePath))) { @@ -324,7 +333,11 @@ class Image implements EntryPoint return $targetImage; } - protected function getOrientation($filePath) + /** + * @param string $filePath + * @return ?int + */ + protected function getOrientation(string $filePath) { $orientation = 0; @@ -335,7 +348,11 @@ class Image implements EntryPoint return $orientation; } - protected function fixOrientation($targetImage, $filePath) + /** + * @param resource|\GdImage $targetImage + * @return resource|\GdImage + */ + protected function fixOrientation($targetImage, string $filePath) { $orientation = $this->getOrientation($filePath); @@ -348,21 +365,33 @@ class Image implements EntryPoint return $targetImage; } + /** + * @return string[] + */ private function getAllowedFileTypeList(): array { return $this->metadata->get(['app', 'image', 'allowedFileTypeList']) ?? []; } + /** + * @return string[] + */ private function getResizableFileTypeList(): array { return $this->metadata->get(['app', 'image', 'resizableFileTypeList']) ?? []; } + /** + * @return string[] + */ private function getFixOrientationFileTypeList(): array { return $this->metadata->get(['app', 'image', 'fixOrientationFileTypeList']) ?? []; } + /** + * @return array + */ protected function getSizes(): array { return $this->metadata->get(['app', 'image', 'sizes']) ?? []; diff --git a/application/Espo/Modules/Crm/Services/Activities.php b/application/Espo/Modules/Crm/Services/Activities.php index 7708403a4c..d2dc4364cf 100644 --- a/application/Espo/Modules/Crm/Services/Activities.php +++ b/application/Espo/Modules/Crm/Services/Activities.php @@ -762,7 +762,7 @@ class Activities implements protected function accessCheck(Entity $entity): void { - if ($entity->getEntityType() == 'User') { + if ($entity instanceof UserEntity) { if (!$this->acl->checkUserPermission($entity, 'user')) { throw new Forbidden(); } diff --git a/application/Espo/Tools/FieldManager/FieldManager.php b/application/Espo/Tools/FieldManager/FieldManager.php index 8f0ed6c232..48b50def0b 100644 --- a/application/Espo/Tools/FieldManager/FieldManager.php +++ b/application/Espo/Tools/FieldManager/FieldManager.php @@ -117,6 +117,10 @@ class FieldManager { $fieldDefs = $this->getFieldDefs($scope, $name); + if ($fieldDefs === null) { + throw new Error("Can't read field defs {$scope}.{$name}."); + } + $fieldDefs['label'] = $this->language->translate($name, 'fields', $scope); $type = $this->metadata->get(['entityDefs', $scope, 'fields', $name, 'type']);