mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
type fixes
This commit is contained in:
@@ -38,9 +38,9 @@ use Espo\Core\{
|
||||
|
||||
class ActionFactory
|
||||
{
|
||||
private $metadata;
|
||||
private Metadata $metadata;
|
||||
|
||||
private $injectableFactory;
|
||||
private InjectableFactory $injectableFactory;
|
||||
|
||||
public function __construct(Metadata $metadata, InjectableFactory $injectableFactory)
|
||||
{
|
||||
@@ -63,6 +63,11 @@ class ActionFactory
|
||||
return $this->injectableFactory->create($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string,object> $with
|
||||
* @deprecated
|
||||
* @todo Remove.
|
||||
*/
|
||||
public function createWith(string $action, ?string $entityType, array $with): Action
|
||||
{
|
||||
$className = $this->getClassName($action, $entityType);
|
||||
@@ -74,6 +79,9 @@ class ActionFactory
|
||||
return $this->injectableFactory->createWith($className, $with);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?class-string
|
||||
*/
|
||||
private function getClassName(string $action, ?string $entityType): ?string
|
||||
{
|
||||
if ($entityType) {
|
||||
@@ -89,6 +97,9 @@ class ActionFactory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?class-string
|
||||
*/
|
||||
private function getEntityTypeClassName(string $action, string $entityType): ?string
|
||||
{
|
||||
return $this->metadata->get(
|
||||
|
||||
@@ -124,6 +124,9 @@ class ConvertCurrency implements Action
|
||||
$this->convertEntity($entity, $fieldList, $targetCurrency, $rates);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $fieldList
|
||||
*/
|
||||
protected function convertEntity(
|
||||
Entity $entity,
|
||||
array $fieldList,
|
||||
@@ -179,6 +182,9 @@ class ConvertCurrency implements Action
|
||||
return CurrencyRates::fromArray($ratesArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getFieldList(string $entityType, Data $data): array
|
||||
{
|
||||
$forbiddenFieldList = $this->acl->getScopeForbiddenFieldList($entityType, 'edit');
|
||||
|
||||
@@ -48,17 +48,17 @@ use Espo\Entities\{
|
||||
EmailAddress,
|
||||
};
|
||||
|
||||
use StdClass;
|
||||
use stdClass;
|
||||
|
||||
class Merger
|
||||
{
|
||||
private $acl;
|
||||
private Acl $acl;
|
||||
|
||||
private $metadata;
|
||||
private Metadata $metadata;
|
||||
|
||||
private $entityManager;
|
||||
private EntityManager $entityManager;
|
||||
|
||||
private $serviceContainer;
|
||||
private ServiceContainer $serviceContainer;
|
||||
|
||||
public function __construct(
|
||||
Acl $acl,
|
||||
@@ -73,10 +73,11 @@ class Merger
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $sourceIdList
|
||||
* @throws NotFound
|
||||
* @throws Forbidden
|
||||
*/
|
||||
public function process(Params $params, array $sourceIdList, StdClass $data): void
|
||||
public function process(Params $params, array $sourceIdList, stdClass $data): void
|
||||
{
|
||||
$clonedData = ObjectUtil::clone($data);
|
||||
|
||||
@@ -171,6 +172,7 @@ class Merger
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $sourceIdList
|
||||
* @return Entity[]
|
||||
* @throws Forbidden
|
||||
* @throws NotFound
|
||||
@@ -323,7 +325,7 @@ class Merger
|
||||
/**
|
||||
* @param PhoneNumber[] $phoneNumberList
|
||||
*/
|
||||
private function preparePhoneNumberData(array $phoneNumberList, StdClass $data): void
|
||||
private function preparePhoneNumberData(array $phoneNumberList, stdClass $data): void
|
||||
{
|
||||
$phoneNumberData = [];
|
||||
|
||||
@@ -354,7 +356,7 @@ class Merger
|
||||
/**
|
||||
* @param EmailAddress[] $emailAddressList
|
||||
*/
|
||||
private function prepareEmailAddressData(array $emailAddressList, StdClass $data): void
|
||||
private function prepareEmailAddressData(array $emailAddressList, stdClass $data): void
|
||||
{
|
||||
$emailAddressData = [];
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class ClearCache implements Runner
|
||||
{
|
||||
use Cli;
|
||||
|
||||
protected $dataManager;
|
||||
private DataManager $dataManager;
|
||||
|
||||
public function __construct(DataManager $dataManager)
|
||||
{
|
||||
|
||||
@@ -34,5 +34,5 @@ namespace Espo\Core\ApplicationRunners;
|
||||
*/
|
||||
trait Cli
|
||||
{
|
||||
public static $cli = true;
|
||||
public static bool $cli = true;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class Job implements RunnerParameterized
|
||||
use Cli;
|
||||
use SetupSystemUser;
|
||||
|
||||
private $jobManager;
|
||||
private JobManager $jobManager;
|
||||
|
||||
public function __construct(JobManager $jobManager)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ class Preload implements Runner
|
||||
echo "Files loaded: " . (string) $count . "." . PHP_EOL;
|
||||
}
|
||||
|
||||
protected function processException(Throwable $e)
|
||||
protected function processException(Throwable $e): void
|
||||
{
|
||||
echo "Error occurred." . PHP_EOL;
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ namespace Espo\Core\ApplicationRunners;
|
||||
*/
|
||||
trait SetupSystemUser
|
||||
{
|
||||
public static $setupSystemUser = true;
|
||||
public static bool $setupSystemUser = true;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Espo\Core\Cleanup;
|
||||
/** @deprecated */
|
||||
abstract class Base extends \Espo\Core\Injectable
|
||||
{
|
||||
protected function init()
|
||||
protected function init() /** @phpstan-ignore-line */
|
||||
{
|
||||
$this->addDependency('config');
|
||||
$this->addDependency('metadata');
|
||||
@@ -40,25 +40,25 @@ abstract class Base extends \Espo\Core\Injectable
|
||||
$this->addDependency('fileManager');
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
protected function getConfig() /** @phpstan-ignore-line */
|
||||
{
|
||||
return $this->getInjection('config');
|
||||
}
|
||||
|
||||
protected function getMetadata()
|
||||
protected function getMetadata() /** @phpstan-ignore-line */
|
||||
{
|
||||
return $this->getInjection('metadata');
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
protected function getEntityManager() /** @phpstan-ignore-line */
|
||||
{
|
||||
return $this->getInjection('entityManager');
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
protected function getFileManager() /** @phpstan-ignore-line */
|
||||
{
|
||||
return $this->getInjection('fileManager');
|
||||
}
|
||||
|
||||
abstract public function process();
|
||||
abstract public function process(); /** @phpstan-ignore-line */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user