summaryrefslogtreecommitdiffstats
path: root/lib/private/Contacts
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-03-04 14:30:21 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-03-04 14:30:21 +0100
commitb14be3468985af50ab304395ef3b17196429fb9a (patch)
treef7b011f429dd6176f031917803cb1694b4d731c4 /lib/private/Contacts
parent3bbacb2f541a513f47e0744ab8a629b936a091d8 (diff)
downloadnextcloud-server-b14be3468985af50ab304395ef3b17196429fb9a.tar.gz
nextcloud-server-b14be3468985af50ab304395ef3b17196429fb9a.zip
Type Entry and IEntry
* Fixed a docblock * Typed the entries Psalm happier, Roeland happier Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Contacts')
-rw-r--r--lib/private/Contacts/ContactsMenu/Entry.php31
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php
index 675d925134b..f70a40bb2ba 100644
--- a/lib/private/Contacts/ContactsMenu/Entry.php
+++ b/lib/private/Contacts/ContactsMenu/Entry.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@@ -49,56 +52,56 @@ class Entry implements IEntry {
/**
* @param string $id
*/
- public function setId($id) {
+ public function setId(string $id): void {
$this->id = $id;
}
/**
* @param string $displayName
*/
- public function setFullName($displayName) {
+ public function setFullName(string $displayName): void {
$this->fullName = $displayName;
}
/**
* @return string
*/
- public function getFullName() {
+ public function getFullName(): string {
return $this->fullName;
}
/**
* @param string $address
*/
- public function addEMailAddress($address) {
+ public function addEMailAddress(string $address): void {
$this->emailAddresses[] = $address;
}
/**
- * @return string
+ * @return string[]
*/
- public function getEMailAddresses() {
+ public function getEMailAddresses(): array {
return $this->emailAddresses;
}
/**
* @param string $avatar
*/
- public function setAvatar($avatar) {
+ public function setAvatar(string $avatar): void {
$this->avatar = $avatar;
}
/**
* @return string
*/
- public function getAvatar() {
+ public function getAvatar(): ?string {
return $this->avatar;
}
/**
* @param IAction $action
*/
- public function addAction(IAction $action) {
+ public function addAction(IAction $action): void {
$this->actions[] = $action;
$this->sortActions();
}
@@ -106,14 +109,14 @@ class Entry implements IEntry {
/**
* @return IAction[]
*/
- public function getActions() {
+ public function getActions(): array {
return $this->actions;
}
/**
* sort the actions by priority and name
*/
- private function sortActions() {
+ private function sortActions(): void {
usort($this->actions, function (IAction $action1, IAction $action2) {
$prio1 = $action1->getPriority();
$prio2 = $action2->getPriority();
@@ -131,7 +134,7 @@ class Entry implements IEntry {
/**
* @param array $contact key-value array containing additional properties
*/
- public function setProperties(array $contact) {
+ public function setProperties(array $contact): void {
$this->properties = $contact;
}
@@ -139,7 +142,7 @@ class Entry implements IEntry {
* @param string $key
* @return mixed
*/
- public function getProperty($key) {
+ public function getProperty(string $key) {
if (!isset($this->properties[$key])) {
return null;
}
@@ -149,7 +152,7 @@ class Entry implements IEntry {
/**
* @return array
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
$otherActions = array_map(function (IAction $action) {
return $action->jsonSerialize();