From 37bda3e5fb39f1b925030d93db1e1392ca4568cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 29 Jul 2022 00:06:49 +0200 Subject: [PATCH] Changes: - fixed wrong type-hint uid => int - added returned type-hint - added some documentation - formatted arrays a bit --- src/Model/OpenWebAuthToken.php | 10 +++++----- src/Module/Diaspora/Receive.php | 4 +++- src/Protocol/Diaspora.php | 18 +++++++++--------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Model/OpenWebAuthToken.php b/src/Model/OpenWebAuthToken.php index b57356a986..a91097599e 100644 --- a/src/Model/OpenWebAuthToken.php +++ b/src/Model/OpenWebAuthToken.php @@ -39,13 +39,13 @@ class OpenWebAuthToken * @return boolean * @throws \Exception */ - public static function create(string $type, uid $uid, string $token, string $meta) + public static function create(string $type, int $uid, string $token, string $meta) { $fields = [ - 'type' => $type, - 'uid' => $uid, - 'token' => $token, - 'meta' => $meta, + 'type' => $type, + 'uid' => $uid, + 'token' => $token, + 'meta' => $meta, 'created' => DateTimeFormat::utcNow() ]; return DBA::insert('openwebauth-token', $fields); diff --git a/src/Module/Diaspora/Receive.php b/src/Module/Diaspora/Receive.php index 3b10493618..ce102df06d 100644 --- a/src/Module/Diaspora/Receive.php +++ b/src/Module/Diaspora/Receive.php @@ -67,6 +67,7 @@ class Receive extends BaseModule /** * Receive a public Diaspora posting * + * @return void * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -84,6 +85,7 @@ class Receive extends BaseModule /** * Receive a Diaspora posting for a user * + * @return void * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -127,7 +129,7 @@ class Receive extends BaseModule * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ - private function decodePost(bool $public = true, string $privKey = '') + private function decodePost(bool $public = true, string $privKey = ''): array { if (empty($_POST['xml'])) { diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 5c0f9b8131..cc02936695 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1357,15 +1357,15 @@ class Diaspora } $fields = [ - 'url' => $data['url'], - 'nurl' => Strings::normaliseLink($data['url']), - 'name' => $data['name'], - 'nick' => $data['nick'], - 'addr' => $data['addr'], - 'batch' => $data['batch'], - 'notify' => $data['notify'], - 'poll' => $data['poll'], - 'network' => $data['network'] + 'url' => $data['url'], + 'nurl' => Strings::normaliseLink($data['url']), + 'name' => $data['name'], + 'nick' => $data['nick'], + 'addr' => $data['addr'], + 'batch' => $data['batch'], + 'notify' => $data['notify'], + 'poll' => $data['poll'], + 'network' => $data['network'], ]; Contact::update($fields, ['addr' => $old_handle]); -- 2.39.5