From 03131507bc130bc60e8293cf4e7ef559eb7d27d1 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sun, 6 Mar 2022 10:31:54 +0200 Subject: [PATCH] type fixes --- application/Espo/Core/Entities/Person.php | 12 +++++++ .../Core/EntryPoint/EntryPointManager.php | 9 ++++-- .../Espo/Core/EntryPoint/Traits/NoAuth.php | 3 ++ .../Core/EntryPoint/Traits/NotStrictAuth.php | 3 ++ application/Espo/Core/EntryPoints/Base.php | 32 +++++++++++-------- application/Espo/Core/Record/Service.php | 2 ++ 6 files changed, 45 insertions(+), 16 deletions(-) diff --git a/application/Espo/Core/Entities/Person.php b/application/Espo/Core/Entities/Person.php index d31401fcfd..b5631f88b9 100644 --- a/application/Espo/Core/Entities/Person.php +++ b/application/Espo/Core/Entities/Person.php @@ -58,6 +58,10 @@ class Person extends Entity $this->helper = $helper; } + /** + * @param string $value + * @return void + */ protected function _setLastName($value) { $this->setInContainer('lastName', $value); @@ -67,6 +71,10 @@ class Person extends Entity $this->setInContainer('name', $name); } + /** + * @param string $value + * @return void + */ protected function _setFirstName($value) { $this->setInContainer('firstName', $value); @@ -76,6 +84,10 @@ class Person extends Entity $this->setInContainer('name', $name); } + /** + * @param string $value + * @return void + */ protected function _setMiddleName($value) { $this->setInContainer('middleName', $value); diff --git a/application/Espo/Core/EntryPoint/EntryPointManager.php b/application/Espo/Core/EntryPoint/EntryPointManager.php index d42fba3a0e..00eeac2bed 100644 --- a/application/Espo/Core/EntryPoint/EntryPointManager.php +++ b/application/Espo/Core/EntryPoint/EntryPointManager.php @@ -43,9 +43,9 @@ use Espo\Core\{ */ class EntryPointManager { - private $injectableFactory; + private InjectableFactory $injectableFactory; - private $classFinder; + private ClassFinder $classFinder; public function __construct(InjectableFactory $injectableFactory, ClassFinder $classFinder) { @@ -86,7 +86,7 @@ class EntryPointManager return $className::$notStrictAuth ?? false; } - public function run(string $name, Request $request, Response $response) + public function run(string $name, Request $request, Response $response): void { $className = $this->getClassName($name); @@ -99,6 +99,9 @@ class EntryPointManager $entryPoint->run($request, $response); } + /** + * @return ?class-string + */ private function getClassName(string $name): ?string { return $this->classFinder->find('EntryPoints', ucfirst($name)); diff --git a/application/Espo/Core/EntryPoint/Traits/NoAuth.php b/application/Espo/Core/EntryPoint/Traits/NoAuth.php index d06406bbc3..fbe9061b0b 100644 --- a/application/Espo/Core/EntryPoint/Traits/NoAuth.php +++ b/application/Espo/Core/EntryPoint/Traits/NoAuth.php @@ -35,5 +35,8 @@ namespace Espo\Core\EntryPoint\Traits; */ trait NoAuth { + /** + * @var bool + */ public static $noAuth = true; } diff --git a/application/Espo/Core/EntryPoint/Traits/NotStrictAuth.php b/application/Espo/Core/EntryPoint/Traits/NotStrictAuth.php index d55b2bd955..15099588e6 100644 --- a/application/Espo/Core/EntryPoint/Traits/NotStrictAuth.php +++ b/application/Espo/Core/EntryPoint/Traits/NotStrictAuth.php @@ -34,5 +34,8 @@ namespace Espo\Core\EntryPoint\Traits; */ trait NotStrictAuth { + /** + * @var bool + */ public static $notStrictAuth = true; } diff --git a/application/Espo/Core/EntryPoints/Base.php b/application/Espo/Core/EntryPoints/Base.php index 68db77bf42..d86187221d 100644 --- a/application/Espo/Core/EntryPoints/Base.php +++ b/application/Espo/Core/EntryPoints/Base.php @@ -34,73 +34,79 @@ use Espo\Core\Container; /** @deprecated */ abstract class Base { + /** + * @var bool + */ public static $authRequired = true; + /** + * @var bool + */ public static $notStrictAuth = false; - private $container; + private $container; /** @phpstan-ignore-line */ public function __construct(Container $container) { $this->container = $container; } - protected function getContainer() + protected function getContainer() /** @phpstan-ignore-line */ { return $this->container; } - protected function getUser() + protected function getUser() /** @phpstan-ignore-line */ { return $this->getContainer()->get('user'); } - protected function getAcl() + protected function getAcl() /** @phpstan-ignore-line */ { return $this->getContainer()->get('acl'); } - protected function getEntityManager() + protected function getEntityManager() /** @phpstan-ignore-line */ { return $this->getContainer()->get('entityManager'); } - protected function getServiceFactory() + protected function getServiceFactory() /** @phpstan-ignore-line */ { return $this->getContainer()->get('serviceFactory'); } - protected function getConfig() + protected function getConfig() /** @phpstan-ignore-line */ { return $this->getContainer()->get('config'); } - protected function getMetadata() + protected function getMetadata() /** @phpstan-ignore-line */ { return $this->getContainer()->get('metadata'); } - protected function getDateTime() + protected function getDateTime() /** @phpstan-ignore-line */ { return $this->getContainer()->get('dateTime'); } - protected function getNumber() + protected function getNumber() /** @phpstan-ignore-line */ { return $this->getContainer()->get('number'); } - protected function getFileManager() + protected function getFileManager() /** @phpstan-ignore-line */ { return $this->getContainer()->get('fileManager'); } - protected function getLanguage() + protected function getLanguage() /** @phpstan-ignore-line */ { return $this->getContainer()->get('language'); } - protected function getClientManager() + protected function getClientManager() /** @phpstan-ignore-line */ { return $this->getContainer()->get('clientManager'); } diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index 1273af767b..5005809f6b 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -1543,9 +1543,11 @@ class Service implements Crud, return null; } + /** @var ?Collection */ return $finder->findByWhere($entity, WhereClause::fromRaw($whereClause)); } + /** @var ?Collection */ return $finder->find($entity); }