aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Contacts/ContactsMenu/Entry.php31
-rw-r--r--lib/public/Contacts/ContactsMenu/IEntry.php10
2 files changed, 22 insertions, 19 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();
diff --git a/lib/public/Contacts/ContactsMenu/IEntry.php b/lib/public/Contacts/ContactsMenu/IEntry.php
index 3ec6188a255..45517885574 100644
--- a/lib/public/Contacts/ContactsMenu/IEntry.php
+++ b/lib/public/Contacts/ContactsMenu/IEntry.php
@@ -34,25 +34,25 @@ interface IEntry extends JsonSerializable {
* @since 12.0
* @return string
*/
- public function getFullName();
+ public function getFullName(): string;
/**
* @since 12.0
* @return string[]
*/
- public function getEMailAddresses();
+ public function getEMailAddresses(): array;
/**
* @since 12.0
* @return string|null image URI
*/
- public function getAvatar();
+ public function getAvatar(): ?string;
/**
* @since 12.0
* @param IAction $action an action to show in the contacts menu
*/
- public function addAction(IAction $action);
+ public function addAction(IAction $action): void;
/**
* Get an arbitrary property from the contact
@@ -61,5 +61,5 @@ interface IEntry extends JsonSerializable {
* @param string $key
* @return mixed the value of the property or null
*/
- public function getProperty($key);
+ public function getProperty(string $key);
}