fix type hint and add annotations

Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
dartcafe 2021-07-11 22:05:20 +02:00
Родитель da7b50139b
Коммит 5053d4fa92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -207,7 +207,7 @@ class PublicController extends Controller {
*/
public function getVotes(string $token): DataResponse {
return $this->response(function () use ($token) {
return ['votes' =>AnonymizeService::replaceUserId($this->voteService->list(0, $token))];
return ['votes' => AnonymizeService::replaceUserId($this->voteService->list(0, $token))];
});
}

Просмотреть файл

@ -117,9 +117,11 @@ class AnonymizeService {
}
/**
* Replaces userIds with displayName to avoid exposing usernames in public polls
* * Replaces userIds with displayName to avoid exposing usernames in public polls
*
* @param (Comment|Option|Poll|Vote)[]|Comment|Option|Poll|Vote $arrayOrObject
*/
public static function replaceUserId(mixed $arrayOrObject) {
public static function replaceUserId($arrayOrObject) {
if (is_array($arrayOrObject)) {
foreach ($arrayOrObject as $item) {
if ($item instanceof Comment || $item instanceof Vote) {