diff --git a/application/Espo/Entities/Attachment.php b/application/Espo/Entities/Attachment.php index f26eff30e3..8c622decdd 100644 --- a/application/Espo/Entities/Attachment.php +++ b/application/Espo/Entities/Attachment.php @@ -78,11 +78,13 @@ class Attachment extends Entity public function getParent(): ?LinkParent { + /** @var ?LinkParent */ return $this->getValueObject('parent'); } public function getRelated(): ?LinkParent { + /** @var ?LinkParent */ return $this->getValueObject('related'); } diff --git a/application/Espo/Entities/Email.php b/application/Espo/Entities/Email.php index 3f6dae31cb..14da8265b0 100644 --- a/application/Espo/Entities/Email.php +++ b/application/Espo/Entities/Email.php @@ -197,6 +197,7 @@ class Email extends Entity return $this->getFromContainer('bodyPlain'); } + /** @var string */ $body = $this->get('body') ?? ''; $breaks = ["
", "
", "
", "
", "<br />", "<br/>", "<br>"]; @@ -231,6 +232,7 @@ class Email extends Entity ]; foreach ($reList as $i => $re) { + /** @var string */ $body = mb_ereg_replace($re, $replaceList[$i], $body, 'i'); } @@ -312,6 +314,7 @@ class Email extends Entity public function getDateSent(): ?DateTime { + /** @var ?DateTime */ return $this->getValueObject('dateSent'); } @@ -504,6 +507,7 @@ class Email extends Entity public function getParent(): ?LinkParent { + /** @var ?LinkParent */ return $this->getValueObject('parent'); } @@ -521,6 +525,7 @@ class Email extends Entity public function getCreatedBy(): ?Link { + /** @var ?Link */ return $this->getValueObject('createdBy'); } diff --git a/application/Espo/Entities/EmailAccount.php b/application/Espo/Entities/EmailAccount.php index 58b23ee548..b44725c7ef 100644 --- a/application/Espo/Entities/EmailAccount.php +++ b/application/Espo/Entities/EmailAccount.php @@ -53,12 +53,14 @@ class EmailAccount extends Entity public function getAssignedUser(): ?Link { + /** @var ?Link */ return $this->getValueObject('assignedUser'); } public function getTeams(): LinkMultiple { - return LinkMultiple::create(); + /** @var LinkMultiple */ + return LinkMultiple::create(); } public function keepFetchedEmailsUnread(): bool @@ -87,11 +89,13 @@ class EmailAccount extends Entity public function getFetchSince(): ?Date { + /** @var ?Date */ return $this->getValueObject('fetchSince'); } public function getEmailFolder(): ?Link { + /** @var ?Link */ return $this->getValueObject('emailFolder'); } diff --git a/application/Espo/Entities/InboundEmail.php b/application/Espo/Entities/InboundEmail.php index fee8515b57..5ae4195ed4 100644 --- a/application/Espo/Entities/InboundEmail.php +++ b/application/Espo/Entities/InboundEmail.php @@ -53,11 +53,13 @@ class InboundEmail extends Entity public function getAssignToUser(): ?Link { + /** @var ?Link */ return $this->getValueObject('assignToUser'); } public function getTeam(): ?Link { + /** @var ?Link */ return $this->getValueObject('team'); } @@ -98,6 +100,7 @@ class InboundEmail extends Entity public function getFetchSince(): ?Date { + /** @var ?Date */ return $this->getValueObject('fetchSince'); } diff --git a/application/Espo/Entities/Note.php b/application/Espo/Entities/Note.php index 59ee0354e3..d1d9e321a4 100644 --- a/application/Espo/Entities/Note.php +++ b/application/Espo/Entities/Note.php @@ -121,6 +121,7 @@ class Note extends Entity public function getCreatedAt(): ?DateTime { + /** @var ?DateTime */ return $this->getValueObject('createdAt'); } diff --git a/application/Espo/Entities/Notification.php b/application/Espo/Entities/Notification.php index e5af823358..c2d21a943f 100644 --- a/application/Espo/Entities/Notification.php +++ b/application/Espo/Entities/Notification.php @@ -81,6 +81,7 @@ class Notification extends \Espo\Core\ORM\Entity public function getRelated(): ?LinkParent { + /** @var ?LinkParent */ return $this->getValueObject('related'); } diff --git a/application/Espo/Entities/Sms.php b/application/Espo/Entities/Sms.php index 9b03114e9c..2228fe6fa4 100644 --- a/application/Espo/Entities/Sms.php +++ b/application/Espo/Entities/Sms.php @@ -51,11 +51,13 @@ class Sms extends Entity implements SmsInterface public function getDateSent(): ?DateTime { + /** @var ?DateTime */ return $this->getValueObject('dateTime'); } public function getCreatedAt(): ?DateTime { + /** @var ?DateTime */ return $this->getValueObject('createdAt'); } diff --git a/application/Espo/Entities/TwoFactorCode.php b/application/Espo/Entities/TwoFactorCode.php index a8a6350a8d..c8a3d3b452 100644 --- a/application/Espo/Entities/TwoFactorCode.php +++ b/application/Espo/Entities/TwoFactorCode.php @@ -42,6 +42,7 @@ class TwoFactorCode extends \Espo\Core\ORM\Entity public function getCreatedAt(): DateTime { + /** @var DateTime */ return $this->getValueObject('createdAt'); } diff --git a/application/Espo/Entities/User.php b/application/Espo/Entities/User.php index e2239bd9ff..0a11c9ac89 100644 --- a/application/Espo/Entities/User.php +++ b/application/Espo/Entities/User.php @@ -101,16 +101,19 @@ class User extends Person public function getRoles(): LinkMultiple { + /** @var LinkMultiple */ return $this->getValueObject('roles'); } public function getDefaultTeam(): ?Link { + /** @var ?Link */ return $this->getValueObject('defaultTeam'); } public function getTeams(): LinkMultiple { + /** @var LinkMultiple */ return $this->getValueObject('teams'); } diff --git a/application/Espo/EntryPoints/Avatar.php b/application/Espo/EntryPoints/Avatar.php index 6ecfdfd8de..26424b34aa 100644 --- a/application/Espo/EntryPoints/Avatar.php +++ b/application/Espo/EntryPoints/Avatar.php @@ -30,6 +30,7 @@ namespace Espo\EntryPoints; use Espo\Core\Exceptions\BadRequest; +use Espo\Core\Exceptions\Error; use Espo\Core\EntryPoints\NotStrictAuth; use Espo\Core\Di; @@ -143,16 +144,28 @@ class Avatar extends Image implements Di\MetadataAware $img = imagecreatetruecolor(14, 14); + if ($img === false) { + throw new Error(); + } + imagesavealpha($img, true); $color = imagecolorallocatealpha($img, 127, 127, 127, 127); + if ($color === false) { + throw new Error(); + } + imagefill($img, 0, 0, $color); imagepng($img); imagecolordeallocate($img, $color); $contents = ob_get_contents(); + if ($contents === false) { + throw new Error(); + } + ob_end_clean(); imagedestroy($img);