type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-04 11:55:57 +02:00
parent b568e96407
commit 5d5268c2c7
6 changed files with 20 additions and 5 deletions

View File

@@ -49,6 +49,9 @@ class EmailFactory
*/
public function create(): Email
{
return $this->entityManager->getNewEntity(Email::ENTITY_TYPE);
/** @var Email $email */
$email = $this->entityManager->getNewEntity(Email::ENTITY_TYPE);
return $email;
}
}

View File

@@ -100,10 +100,9 @@ class Importer
$parser = $message->getParser() ?? $this->parserFactory->create();
/** @var Email $email */
$email = $this->entityManager->getEntity('Email');
assert($email instanceof Email);
$email->set('isBeingImported', true);
$subject = '';
@@ -201,6 +200,7 @@ class Importer
$duplicate = $this->findDuplicate($email);
if ($duplicate && $duplicate->get('status') !== Email::STATUS_BEING_IMPORTED) {
/** @var Email $duplicate */
$duplicate = $this->entityManager->getEntity('Email', $duplicate->getId());
$this->processDuplicate(
@@ -339,6 +339,7 @@ class Importer
$this->entityManager->getLocker()->rollback();
if ($duplicate->get('status') !== Email::STATUS_BEING_IMPORTED) {
/** @var Email $duplicate */
$duplicate = $this->entityManager->getEntity('Email', $duplicate->getId());
$this->processDuplicate(
@@ -618,6 +619,7 @@ class Importer
return null;
}
/** @var Email $duplicate */
$duplicate = $this->entityManager
->getRDBRepository('Email')
->select(['id', 'status'])

View File

@@ -43,6 +43,9 @@ class XQueueItemId implements Header\HeaderInterface
protected $id = null;
/**
* @return self
*/
public static function fromString($headerLine)
{
list($name, $value) = Header\GenericHeader::splitHeaderLine($headerLine);

View File

@@ -273,6 +273,7 @@ class MailMimeParser implements Parser
continue;
}
/** @var Attachment $attachment */
$attachment = $this->entityManager->getEntity('Attachment');
$contentType = $this->detectAttachmentContentType($attachmentPart);

View File

@@ -380,7 +380,8 @@ class Sender
$address = $this->config->get('outboundEmailFromAddress');
if (!$this->systemInboundEmailIsCached && $address) {
$this->systemInboundEmail = $this->entityManager
/** @var ?InboundEmail $systemInboundEmail */
$systemInboundEmail = $this->entityManager
->getRDBRepository('InboundEmail')
->where([
'status' => 'Active',
@@ -388,6 +389,8 @@ class Sender
'emailAddress' => $address,
])
->findOne();
$this->systemInboundEmail = $systemInboundEmail;
}
$this->systemInboundEmailIsCached = true;

View File

@@ -49,6 +49,9 @@ class SmsFactory
*/
public function create(): SmsEntity
{
return $this->entityManager->getNewEntity(SmsEntity::ENTITY_TYPE);
/** @var SmsEntity $sms */
$sms = $this->entityManager->getNewEntity(SmsEntity::ENTITY_TYPE);
return $sms;
}
}