diff --git a/application/Espo/Classes/AppInfo/Container.php b/application/Espo/Classes/AppInfo/Container.php index a94b58576b..0db381016b 100644 --- a/application/Espo/Classes/AppInfo/Container.php +++ b/application/Espo/Classes/AppInfo/Container.php @@ -63,10 +63,11 @@ class Container 'user', ]; + /** @var string[] */ $fileList = scandir('application/Espo/Core/Loaders'); if (file_exists('custom/Espo/Custom/Core/Loaders')) { - $fileList = array_merge($fileList, scandir('custom/Espo/Custom/Core/Loaders')); + $fileList = array_merge($fileList, scandir('custom/Espo/Custom/Core/Loaders') ?: []); } foreach ($fileList as $file) { diff --git a/application/Espo/Classes/AssignmentNotificators/Email.php b/application/Espo/Classes/AssignmentNotificators/Email.php index 1c3366b356..e6365f03d4 100644 --- a/application/Espo/Classes/AssignmentNotificators/Email.php +++ b/application/Espo/Classes/AssignmentNotificators/Email.php @@ -35,7 +35,7 @@ use Espo\Services\Stream as StreamService; use Espo\Core\Notification\AssignmentNotificator; use Espo\Core\Notification\AssignmentNotificator\Params; use Espo\Core\Notification\UserEnabledChecker; -use Espo\Core\ServiceFactory; +use Espo\Core\InjectableFactory; use Espo\Core\AclManager; use Espo\ORM\EntityManager; @@ -61,7 +61,7 @@ class Email implements AssignmentNotificator private $entityManager; - private $serviceFactory; + private $injectableFactory; private $aclManager; @@ -71,13 +71,13 @@ class Email implements AssignmentNotificator User $user, EntityManager $entityManager, UserEnabledChecker $userChecker, - ServiceFactory $serviceFactory, + InjectableFactory $injectableFactory, AclManager $aclManager ) { $this->user = $user; $this->entityManager = $entityManager; $this->userChecker = $userChecker; - $this->serviceFactory = $serviceFactory; + $this->injectableFactory = $injectableFactory; $this->aclManager = $aclManager; } @@ -294,7 +294,7 @@ class Email implements AssignmentNotificator private function getStreamService(): StreamService { if (empty($this->streamService)) { - $this->streamService = $this->serviceFactory->create('Stream'); + $this->streamService = $this->injectableFactory->create(StreamService::class); } return $this->streamService; diff --git a/application/Espo/Classes/ConsoleCommands/Import.php b/application/Espo/Classes/ConsoleCommands/Import.php index f34372927c..a770e5c640 100644 --- a/application/Espo/Classes/ConsoleCommands/Import.php +++ b/application/Espo/Classes/ConsoleCommands/Import.php @@ -31,6 +31,8 @@ namespace Espo\Classes\ConsoleCommands; use Espo\Tools\Import\Service; +use Espo\Core\Utils\File\Manager as FileManager; + use Espo\Core\{ Console\Command, Console\Command\Params, @@ -41,11 +43,14 @@ use Throwable; class Import implements Command { - private $service; + private Service $service; - public function __construct(Service $service) + private FileManager $fileManager; + + public function __construct(Service $service, FileManager $fileManager) { $this->service = $service; + $this->fileManager = $fileManager; } public function run(Params $params, IO $io) : void @@ -64,13 +69,13 @@ class Import implements Command return; } - if (!file_exists($filePath)) { + if (!$this->fileManager->isFile($filePath)) { $io->writeLine("File not found."); return; } - $contents = file_get_contents($filePath); + $contents = $this->fileManager->getContents($filePath); try { $result = $this->service->importContentsWithParamsId($contents, $paramsId); diff --git a/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php b/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php index 1e37c603af..68a399c875 100644 --- a/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php +++ b/application/Espo/Classes/FieldProcessing/Email/IcsDataLoader.php @@ -47,6 +47,7 @@ use ICal\ICal; use ICal\Event; use Throwable; +use stdClass; /** * @implements Loader<\Espo\Entities\Email> @@ -174,7 +175,7 @@ class IcsDataLoader implements Loader } } - private function loadCreatedEvent(Entity $entity, EspoEvent $espoEvent, object $eventData): void + private function loadCreatedEvent(Entity $entity, EspoEvent $espoEvent, stdClass $eventData): void { $emailSameEvent = $this->entityManager ->getRDBRepository(Email::ENTITY_TYPE) diff --git a/application/Espo/Classes/FieldProcessing/Email/StringDataLoader.php b/application/Espo/Classes/FieldProcessing/Email/StringDataLoader.php index 05030a4581..b736ac5bfa 100644 --- a/application/Espo/Classes/FieldProcessing/Email/StringDataLoader.php +++ b/application/Espo/Classes/FieldProcessing/Email/StringDataLoader.php @@ -104,6 +104,7 @@ class StringDataLoader implements Loader return; } + /** @var ?string */ $fromEmailAddressId = $entity->get('fromEmailAddressId'); if (!$fromEmailAddressId) {