diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-11-25 11:46:18 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-11-25 11:46:18 +0100 |
commit | 6828a3b28d6872cb24c6a6449a7634c38e3d5d88 (patch) | |
tree | 26426e05c10afe1f702bc4dc7005a4feefc6204c /apps/contactsinteraction/lib/Db | |
parent | 5f3585d8175bab56899883457313fafa442fc9dc (diff) | |
download | nextcloud-server-6828a3b28d6872cb24c6a6449a7634c38e3d5d88.tar.gz nextcloud-server-6828a3b28d6872cb24c6a6449a7634c38e3d5d88.zip |
Cleanup contactsinteraction
- Add more typing and use PHP 7.4 typed properties
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/contactsinteraction/lib/Db')
-rw-r--r-- | apps/contactsinteraction/lib/Db/CardSearchDao.php | 4 | ||||
-rw-r--r-- | apps/contactsinteraction/lib/Db/RecentContact.php | 24 | ||||
-rw-r--r-- | apps/contactsinteraction/lib/Db/RecentContactMapper.php | 19 |
3 files changed, 10 insertions, 37 deletions
diff --git a/apps/contactsinteraction/lib/Db/CardSearchDao.php b/apps/contactsinteraction/lib/Db/CardSearchDao.php index 4bf9d9367c4..6bd6538257c 100644 --- a/apps/contactsinteraction/lib/Db/CardSearchDao.php +++ b/apps/contactsinteraction/lib/Db/CardSearchDao.php @@ -32,9 +32,7 @@ use function is_resource; use function stream_get_contents; class CardSearchDao { - - /** @var IDBConnection */ - private $db; + private IDBConnection $db; public function __construct(IDBConnection $db) { $this->db = $db; diff --git a/apps/contactsinteraction/lib/Db/RecentContact.php b/apps/contactsinteraction/lib/Db/RecentContact.php index 306792b434e..7160ef1077b 100644 --- a/apps/contactsinteraction/lib/Db/RecentContact.php +++ b/apps/contactsinteraction/lib/Db/RecentContact.php @@ -42,24 +42,12 @@ use OCP\AppFramework\Db\Entity; * @method int getLastContact() */ class RecentContact extends Entity { - - /** @var string */ - protected $actorUid; - - /** @var string|null */ - protected $uid; - - /** @var string|null */ - protected $email; - - /** @var string|null */ - protected $federatedCloudId; - - /** @var string */ - protected $card; - - /** @var int */ - protected $lastContact; + protected string $actorUid = ''; + protected ?string $uid = null; + protected ?string $email = null; + protected ?string $federatedCloudId = null; + protected string $card = ''; + protected int $lastContact = -1; public function __construct() { $this->addType('actorUid', 'string'); diff --git a/apps/contactsinteraction/lib/Db/RecentContactMapper.php b/apps/contactsinteraction/lib/Db/RecentContactMapper.php index d606c07152a..49a705af570 100644 --- a/apps/contactsinteraction/lib/Db/RecentContactMapper.php +++ b/apps/contactsinteraction/lib/Db/RecentContactMapper.php @@ -56,10 +56,6 @@ class RecentContactMapper extends QBMapper { } /** - * @param string $uid - * @param int $id - * - * @return RecentContact * @throws DoesNotExistException */ public function find(string $uid, int $id): RecentContact { @@ -75,11 +71,6 @@ class RecentContactMapper extends QBMapper { } /** - * @param IUser $user - * @param string|null $uid - * @param string|null $email - * @param string|null $cloudId - * * @return RecentContact[] */ public function findMatch(IUser $user, @@ -108,11 +99,7 @@ class RecentContactMapper extends QBMapper { return $this->findEntities($select); } - /** - * @param string $uid - * @return int|null - */ - public function findLastUpdatedForUserId(string $uid):?int { + public function findLastUpdatedForUserId(string $uid): ?int { $qb = $this->db->getQueryBuilder(); $select = $qb @@ -122,7 +109,7 @@ class RecentContactMapper extends QBMapper { ->orderBy('last_contact', 'DESC') ->setMaxResults(1); - $cursor = $select->execute(); + $cursor = $select->executeQuery(); $row = $cursor->fetch(); if ($row === false) { @@ -139,6 +126,6 @@ class RecentContactMapper extends QBMapper { ->delete($this->getTableName()) ->where($qb->expr()->lt('last_contact', $qb->createNamedParameter($olderThan))); - $delete->execute(); + $delete->executeStatement(); } } |