Bugfix: more function return type errors

This commit is contained in:
djmaze 2020-03-16 16:35:25 +01:00
parent 2cf35057a5
commit 23e9964997
2 changed files with 8 additions and 9 deletions

View file

@ -365,16 +365,16 @@ class ManageSieveClient extends \MailSo\Net\NetClient
return $sScriptName === $this->GetActiveScriptName(); return $sScriptName === $this->GetActiveScriptName();
} }
private function parseLine(string $sLine) : array private function parseLine(string $sLine) : ?array
{ {
if (false === $sLine || null === $sLine || \in_array(\substr($sLine, 0, 2), array('OK', 'NO'))) if (false === $sLine || null === $sLine || \in_array(\substr($sLine, 0, 2), array('OK', 'NO')))
{ {
return false; return null;
} }
$iStart = -1; $iStart = -1;
$iIndex = 0; $iIndex = 0;
$aResult = false; $aResult = array();
for ($iPos = 0; $iPos < \strlen($sLine); $iPos++) for ($iPos = 0; $iPos < \strlen($sLine); $iPos++)
{ {
@ -386,14 +386,13 @@ class ManageSieveClient extends \MailSo\Net\NetClient
} }
else else
{ {
$aResult = \is_array($aResult) ? $aResult : array();
$aResult[$iIndex++] = \substr($sLine, $iStart + 1, $iPos - $iStart - 1); $aResult[$iIndex++] = \substr($sLine, $iStart + 1, $iPos - $iStart - 1);
$iStart = -1; $iStart = -1;
} }
} }
} }
return \is_array($aResult) && isset($aResult[0]) ? $aResult : false; return isset($aResult[0]) ? $aResult : null;
} }
/** /**

View file

@ -54,7 +54,7 @@ class Contact
$this->Clear(); $this->Clear();
} }
public function Clear() public function Clear() : void
{ {
$this->IdContact = ''; $this->IdContact = '';
$this->IdContactStr = ''; $this->IdContactStr = '';
@ -66,7 +66,7 @@ class Contact
$this->Etag = ''; $this->Etag = '';
} }
public function PopulateDisplayAndFullNameValue(bool $bForceFullNameReplace = false) public function PopulateDisplayAndFullNameValue(bool $bForceFullNameReplace = false) : void
{ {
$sFullName = ''; $sFullName = '';
$sLastName = ''; $sLastName = '';
@ -151,7 +151,7 @@ class Contact
} }
} }
public function UpdateDependentValues() public function UpdateDependentValues() : void
{ {
if (empty($this->IdContactStr)) if (empty($this->IdContactStr))
{ {
@ -161,7 +161,7 @@ class Contact
$this->PopulateDisplayAndFullNameValue(); $this->PopulateDisplayAndFullNameValue();
} }
public function RegenerateContactStr() : array public function RegenerateContactStr() : void
{ {
$this->IdContactStr = \class_exists('SabreForRainLoop\DAV\Client') ? $this->IdContactStr = \class_exists('SabreForRainLoop\DAV\Client') ?
\SabreForRainLoop\DAV\UUIDUtil::getUUID() : \MailSo\Base\Utils::Md5Rand(); \SabreForRainLoop\DAV\UUIDUtil::getUUID() : \MailSo\Base\Utils::Md5Rand();