Bugfix: @param/@return documentation was incorrect which caused errors

This commit is contained in:
djmaze 2020-03-16 15:48:58 +01:00
parent 7eb1defa16
commit b81b36d120
10 changed files with 33 additions and 32 deletions

View file

@ -106,7 +106,7 @@ class Crypt
return self::long2str($aV, true); return self::long2str($aV, true);
} }
private static function long2str(array $aV, array $aW) : string private static function long2str(array $aV, bool $aW) : string
{ {
$iLen = \count($aV); $iLen = \count($aV);
$iN = ($iLen - 1) << 2; $iN = ($iLen - 1) << 2;

View file

@ -1296,11 +1296,11 @@ END;
return ''; return '';
} }
public static function Utf8Clear(string $sUtfString, string $sReplaceOn = '') : string public static function Utf8Clear(?string $sUtfString, string $sReplaceOn = '') : string
{ {
if ('' === $sUtfString) if (!strlen($sUtfString))
{ {
return $sUtfString; return '';
} }
$sUtfString = \preg_replace(static::$sValidUtf8Regexp, '$1', $sUtfString); $sUtfString = \preg_replace(static::$sValidUtf8Regexp, '$1', $sUtfString);

View file

@ -92,9 +92,9 @@ class BodyStructure
*/ */
private $aSubParts; private $aSubParts;
private function __construct(string $sContentType, string $sCharset, array $aBodyParams, string $sContentID, private function __construct(string $sContentType, ?string $sCharset, array $aBodyParams, ?string $sContentID,
string $sDescription, string $sMailEncodingName, string $sDisposition, array $aDispositionParams, string $sFileName, ?string $sDescription, ?string $sMailEncodingName, ?string $sDisposition, ?array $aDispositionParams, string $sFileName,
string $sLanguage, string $sLocation, int $iSize, int $iTextLineCount, string $sPartID, array $aSubParts) ?string $sLanguage, ?string $sLocation, int $iSize, int $iTextLineCount, string $sPartID, ?array $aSubParts)
{ {
$this->sContentType = $sContentType; $this->sContentType = $sContentType;
$this->sCharset = $sCharset; $this->sCharset = $sCharset;

View file

@ -874,9 +874,9 @@ class ImapClient extends \MailSo\Net\NetClient
* @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception
*/ */
public function Quota() : array public function Quota() : ?array
{ {
$aReturn = false; $aReturn = null;
if ($this->IsSupported('QUOTA')) if ($this->IsSupported('QUOTA'))
{ {
$this->SendRequest('GETQUOTAROOT "INBOX"'); $this->SendRequest('GETQUOTAROOT "INBOX"');
@ -1663,10 +1663,11 @@ class ImapClient extends \MailSo\Net\NetClient
} }
/** /**
* @return array|string
* @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Net\Exceptions\Exception
*/ */
private function partialParseResponseBranch(&$oImapResponse, int $iStackIndex = -1, private function partialParseResponseBranch(&$oImapResponse, int $iStackIndex = -1,
bool $bTreatAsAtom = false, string $sParentToken = '', string $sOpenBracket = '') : array bool $bTreatAsAtom = false, string $sParentToken = '', string $sOpenBracket = '')
{ {
$mNull = null; $mNull = null;

View file

@ -125,7 +125,7 @@ class Logger extends \MailSo\Base\Collection
return 0 < $this->Count(); return 0 < $this->Count();
} }
public function AddSecret(string $sWord) : bool public function AddSecret(string $sWord) : void
{ {
if (\is_string($sWord) && 0 < \strlen(\trim($sWord))) if (\is_string($sWord) && 0 < \strlen(\trim($sWord)))
{ {

View file

@ -138,7 +138,7 @@ class Folder
return $this->oImapFolder->FlagsLowerCase(); return $this->oImapFolder->FlagsLowerCase();
} }
public function SubFolders(bool $bCreateIfNull = false) : \MailSo\Mail\FolderCollection public function SubFolders(bool $bCreateIfNull = false) : ?\MailSo\Mail\FolderCollection
{ {
if ($bCreateIfNull && !$this->oSubFolders) if ($bCreateIfNull && !$this->oSubFolders)
{ {

View file

@ -703,7 +703,7 @@ class MailClient
* @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception
*/ */
public function FolderInformation(string $sFolderName, string $sPrevUidNext = '', array $aUids = array()) : string public function FolderInformation(string $sFolderName, string $sPrevUidNext = '', array $aUids = array()) : array
{ {
$aFlags = array(); $aFlags = array();
@ -1879,7 +1879,7 @@ class MailClient
return $oMessageCollection; return $oMessageCollection;
} }
public function Quota() : array public function Quota() : ?array
{ {
return $this->oImapClient->Quota(); return $this->oImapClient->Quota();
} }

View file

@ -345,37 +345,37 @@ class Message
return $this->iPriority; return $this->iPriority;
} }
public function Sender() : \MailSo\Mime\EmailCollection public function Sender() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oSender; return $this->oSender;
} }
public function ReplyTo() : \MailSo\Mime\EmailCollection public function ReplyTo() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oReplyTo; return $this->oReplyTo;
} }
public function DeliveredTo() : \MailSo\Mime\EmailCollection public function DeliveredTo() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oDeliveredTo; return $this->oDeliveredTo;
} }
public function To() : \MailSo\Mime\EmailCollection public function To() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oTo; return $this->oTo;
} }
public function Cc() : \MailSo\Mime\EmailCollection public function Cc() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oCc; return $this->oCc;
} }
public function Bcc() : \MailSo\Mime\EmailCollection public function Bcc() : ?\MailSo\Mime\EmailCollection
{ {
return $this->oBcc; return $this->oBcc;
} }
public function Attachments() : \MailSo\Mail\AttachmentCollection public function Attachments() : ?\MailSo\Mail\AttachmentCollection
{ {
return $this->oAttachments; return $this->oAttachments;
} }

View file

@ -130,7 +130,7 @@ class HeaderCollection extends \MailSo\Base\Collection
return (null !== $oParameters) ? $oParameters->ParameterValueByName($sParamName) : ''; return (null !== $oParameters) ? $oParameters->ParameterValueByName($sParamName) : '';
} }
public function &GetByName(string $sHeaderName) : \MailSo\Mime\Header public function &GetByName(string $sHeaderName) : ?\MailSo\Mime\Header
{ {
$oResult = $oHeader = null; $oResult = $oHeader = null;
@ -266,7 +266,7 @@ class HeaderCollection extends \MailSo\Base\Collection
return $this; return $this;
} }
public function DkimStatuses() : int public function DkimStatuses() : array
{ {
$aResult = array(); $aResult = array();
@ -342,7 +342,7 @@ class HeaderCollection extends \MailSo\Base\Collection
return $aResult; return $aResult;
} }
public function PopulateEmailColectionByDkim($oEmails) : int public function PopulateEmailColectionByDkim($oEmails) : void
{ {
if ($oEmails && $oEmails instanceof \MailSo\Mime\EmailCollection) if ($oEmails && $oEmails instanceof \MailSo\Mime\EmailCollection)
{ {

View file

@ -631,7 +631,7 @@ class Actions
/** /**
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function GetAccount(bool $bThrowExceptionOnFalse = false) : \RainLoop\Model\Account public function GetAccount(bool $bThrowExceptionOnFalse = false) : ?\RainLoop\Model\Account
{ {
return $this->getAccountFromToken($bThrowExceptionOnFalse); return $this->getAccountFromToken($bThrowExceptionOnFalse);
} }
@ -1082,9 +1082,9 @@ class Actions
/** /**
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function GetAccountFromCustomToken(string $sToken, bool $bThrowExceptionOnFalse = true, bool $bValidateShortToken = true, bool $bQ = false) : \RainLoop\Model\Account public function GetAccountFromCustomToken(string $sToken, bool $bThrowExceptionOnFalse = true, bool $bValidateShortToken = true, bool $bQ = false) : ?\RainLoop\Model\Account
{ {
$oResult = false; $oResult = null;
if (!empty($sToken)) if (!empty($sToken))
{ {
$aAccountHash = $bQ ? \RainLoop\Utils::DecodeKeyValuesQ($sToken) : \RainLoop\Utils::DecodeKeyValues($sToken); $aAccountHash = $bQ ? \RainLoop\Utils::DecodeKeyValuesQ($sToken) : \RainLoop\Utils::DecodeKeyValues($sToken);
@ -1127,9 +1127,9 @@ class Actions
return $oResult; return $oResult;
} }
public function GetAccountFromSignMeToken() : \RainLoop\Model\Account public function GetAccountFromSignMeToken() : ?\RainLoop\Model\Account
{ {
$oAccount = false; $oAccount = null;
$sSignMeToken = \RainLoop\Utils::GetCookie(\RainLoop\Actions::AUTH_SIGN_ME_TOKEN_KEY, ''); $sSignMeToken = \RainLoop\Utils::GetCookie(\RainLoop\Actions::AUTH_SIGN_ME_TOKEN_KEY, '');
if (!empty($sSignMeToken)) if (!empty($sSignMeToken))
@ -1166,7 +1166,7 @@ class Actions
/** /**
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function getAccountFromToken(bool $bThrowExceptionOnFalse = true) : \RainLoop\Model\Account public function getAccountFromToken(bool $bThrowExceptionOnFalse = true) : ?\RainLoop\Model\Account
{ {
return $this->GetAccountFromCustomToken($this->getLocalAuthToken(), $bThrowExceptionOnFalse, true, true); return $this->GetAccountFromCustomToken($this->getLocalAuthToken(), $bThrowExceptionOnFalse, true, true);
} }
@ -1307,7 +1307,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (!$bAdmin) if (!$bAdmin)
{ {
$oAccount = $this->getAccountFromToken(false); $oAccount = $this->getAccountFromToken(false);
if ($oAccount instanceof \RainLoop\Model\Account) if ($oAccount)
{ {
$aResult['IncludeCss'] = $aResult['UserCss']; $aResult['IncludeCss'] = $aResult['UserCss'];