More params and returns to PHP 7.3+

This commit is contained in:
djmaze 2020-03-16 13:08:53 +01:00
parent 3d246ae842
commit 26c38b3ec9
95 changed files with 1028 additions and 4865 deletions

View file

@ -56,12 +56,12 @@ class PdoAddressBook
));
}
private function updateContactEtagAndTime(int $iUserID, int $mID, string $sEtag, int $iChanged)
private function updateContactEtagAndTime(int $iUserID, int $iID, string $sEtag, int $iChanged)
{
return !!$this->prepareAndExecute('UPDATE rainloop_ab_contacts SET changed = :changed, etag = :etag '.
'WHERE id_user = :id_user AND id_contact = :id_contact', array(
':id_user' => array($iUserID, \PDO::PARAM_INT),
':id_contact' => array($mID, \PDO::PARAM_INT),
':id_contact' => array($iID, \PDO::PARAM_INT),
':changed' => array($iChanged, \PDO::PARAM_INT),
':etag' => array($sEtag, \PDO::PARAM_STR)
)
@ -239,7 +239,7 @@ class PdoAddressBook
return $aResponse;
}
private function getContactsPaths(\SabreForRainLoop\DAV\Client &$oClient, string $sUser, string $sPassword, string $sProxy = '') : array
private function getContactsPaths(\SabreForRainLoop\DAV\Client $oClient, string $sUser, string $sPassword, string $sProxy = '') : array
{
$aContactsPaths = array();
@ -425,7 +425,7 @@ class PdoAddressBook
return $aContactsPaths;
}
private function checkContactsPath(\SabreForRainLoop\DAV\Client &$oClient, string $sPath) : bool
private function checkContactsPath(\SabreForRainLoop\DAV\Client $oClient, string $sPath) : bool
{
if (!$oClient)
{
@ -475,7 +475,7 @@ class PdoAddressBook
return $bGood;
}
public function getDavClientFromUrl(string $sUrl, string $sUser, string $sPassword, string $sProxy = '')
public function getDavClientFromUrl(string $sUrl, string $sUser, string $sPassword, string $sProxy = '') : \SabreForRainLoop\DAV\Client
{
if (!\preg_match('/^http[s]?:\/\//i', $sUrl))
{
@ -527,11 +527,11 @@ class PdoAddressBook
return $oClient;
}
public function getDavClient(string $sUrl, string $sUser, string $sPassword, string $sProxy = '') : bool
public function getDavClient(string $sUrl, string $sUser, string $sPassword, string $sProxy = '') : ?\SabreForRainLoop\DAV\Client
{
if (!\class_exists('SabreForRainLoop\DAV\Client'))
{
return false;
return null;
}
$aMatch = array();
@ -548,7 +548,7 @@ class PdoAddressBook
$oClient = $this->getDavClientFromUrl($sUrl, $sUser, $sPassword, $sProxy);
if (!$oClient)
{
return false;
return null;
}
$bGood = false;
@ -1168,10 +1168,8 @@ class PdoAddressBook
/**
* @param mixed $mID
*
* @return \RainLoop\Providers\AddressBook\Classes\Contact|null
*/
public function GetContactByID(string $sEmail, $mID, bool $bIsStrID = false)
public function GetContactByID(string $sEmail, $mID, bool $bIsStrID = false) : ?\RainLoop\Providers\AddressBook\Classes\Contact
{
$mID = \trim($mID);