mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
Fix null array return types
This commit is contained in:
parent
f5167c76f8
commit
fdb41e546e
4 changed files with 26 additions and 26 deletions
|
|
@ -21,22 +21,22 @@ class TelegramApi
|
|||
$this->token = $token;
|
||||
}
|
||||
|
||||
function getMe(): ?array
|
||||
function getMe(): array
|
||||
{
|
||||
return $this->makeGetRequest('getMe');
|
||||
}
|
||||
|
||||
function getUpdates(?array $params = null): ?array
|
||||
function getUpdates(?array $params = null): array
|
||||
{
|
||||
return $this->makePostRequest('getUpdates', $params ?? []);
|
||||
}
|
||||
|
||||
function sendMessage(array $params): ?array
|
||||
function sendMessage(array $params): array
|
||||
{
|
||||
return $this->makePostRequest('sendMessage', $params);
|
||||
}
|
||||
|
||||
private function makeGetRequest(string $method): ?array
|
||||
private function makeGetRequest(string $method): array
|
||||
{
|
||||
$options = array(
|
||||
'http' => array(
|
||||
|
|
@ -67,7 +67,7 @@ class TelegramApi
|
|||
return $decodedBody['result'] ?? [];
|
||||
}
|
||||
|
||||
private function makePostRequest(string $method, array $params): ?array
|
||||
private function makePostRequest(string $method, array $params): array
|
||||
{
|
||||
$json = json_encode($params, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
$options = array(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AuthController extends ApiController {
|
|||
}
|
||||
}
|
||||
|
||||
private function login(): ?array
|
||||
private function login(): array
|
||||
{
|
||||
check_token();
|
||||
$t = array('logged' => 0);
|
||||
|
|
@ -35,7 +35,7 @@ class AuthController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function logout(): ?array
|
||||
private function logout(): array
|
||||
{
|
||||
check_token();
|
||||
updateSessionLogged(false);
|
||||
|
|
@ -45,7 +45,7 @@ class AuthController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function createSession(): ?array
|
||||
private function createSession(): array
|
||||
{
|
||||
$t = array();
|
||||
if (!need_auth()) {
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class ListsController extends ApiController {
|
|||
);
|
||||
}
|
||||
|
||||
private function createList(): ?array
|
||||
private function createList(): array
|
||||
{
|
||||
$t = array();
|
||||
$t['total'] = 0;
|
||||
|
|
@ -210,7 +210,7 @@ class ListsController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function renameList(int $id): ?array
|
||||
private function renameList(int $id): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$t = array();
|
||||
|
|
@ -225,7 +225,7 @@ class ListsController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function sortList(int $listId): ?array
|
||||
private function sortList(int $listId): array
|
||||
{
|
||||
$sort = (int)($this->req->jsonBody['sort'] ?? 0);
|
||||
self::setListSortingById($listId, $sort);
|
||||
|
|
@ -262,7 +262,7 @@ class ListsController extends ApiController {
|
|||
}
|
||||
}
|
||||
|
||||
private function publishList(int $listId): ?array
|
||||
private function publishList(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$publish = (int)($this->req->jsonBody['publish'] ?? 0);
|
||||
|
|
@ -270,7 +270,7 @@ class ListsController extends ApiController {
|
|||
return ['total'=>1];
|
||||
}
|
||||
|
||||
private function enableFeedKey(int $listId): ?array
|
||||
private function enableFeedKey(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$flag = (int)($this->req->jsonBody['enable'] ?? 0);
|
||||
|
|
@ -297,7 +297,7 @@ class ListsController extends ApiController {
|
|||
];
|
||||
}
|
||||
|
||||
private function showNotes(int $listId): ?array
|
||||
private function showNotes(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$flag = (int)($this->req->jsonBody['shownotes'] ?? 0);
|
||||
|
|
@ -306,7 +306,7 @@ class ListsController extends ApiController {
|
|||
return ['total'=>1];
|
||||
}
|
||||
|
||||
private function hideList(int $listId): ?array
|
||||
private function hideList(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$flag = (int)($this->req->jsonBody['hide'] ?? 0);
|
||||
|
|
@ -322,7 +322,7 @@ class ListsController extends ApiController {
|
|||
return ['total'=>1];
|
||||
}
|
||||
|
||||
private function clearCompleted(int $listId): ?array
|
||||
private function clearCompleted(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$t = array();
|
||||
|
|
@ -342,7 +342,7 @@ class ListsController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function changeListOrder(): ?array
|
||||
private function changeListOrder(): array
|
||||
{
|
||||
$t = array();
|
||||
$t['total'] = 0;
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ class TasksController extends ApiController {
|
|||
|
||||
/* Private Functions */
|
||||
|
||||
private function newTaskInList(int $listId): ?array
|
||||
private function newTaskInList(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$t = array();
|
||||
|
|
@ -376,7 +376,7 @@ class TasksController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function fullNewTaskInList(int $listId): ?array
|
||||
private function fullNewTaskInList(int $listId): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$title = trim($this->req->jsonBody['title'] ?? '');
|
||||
|
|
@ -414,7 +414,7 @@ class TasksController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function editTask(int $id): ?array
|
||||
private function editTask(int $id): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$title = trim($this->req->jsonBody['title'] ?? '');
|
||||
|
|
@ -446,7 +446,7 @@ class TasksController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function moveTask(int $id): ?array
|
||||
private function moveTask(int $id): array
|
||||
{
|
||||
$fromId = (int)($this->req->jsonBody['from'] ?? 0);
|
||||
$toId = (int)($this->req->jsonBody['to'] ?? 0);
|
||||
|
|
@ -496,7 +496,7 @@ class TasksController extends ApiController {
|
|||
return true;
|
||||
}
|
||||
|
||||
private function completeTask(int $id): ?array
|
||||
private function completeTask(int $id): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$compl = (int)($this->req->jsonBody['compl'] ?? 0);
|
||||
|
|
@ -515,7 +515,7 @@ class TasksController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function editNote(int $id): ?array
|
||||
private function editNote(int $id): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$note = $this->req->jsonBody['note'] ?? '';
|
||||
|
|
@ -534,7 +534,7 @@ class TasksController extends ApiController {
|
|||
return $t;
|
||||
}
|
||||
|
||||
private function priorityTask(int $id): ?array
|
||||
private function priorityTask(int $id): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$prio = (int)($this->req->jsonBody['prio'] ?? 0);
|
||||
|
|
@ -555,7 +555,7 @@ class TasksController extends ApiController {
|
|||
}
|
||||
|
||||
|
||||
private function changeTaskOrder(): ?array
|
||||
private function changeTaskOrder(): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$order = $this->req->jsonBody['order'] ?? null;
|
||||
|
|
@ -619,7 +619,7 @@ class TasksController extends ApiController {
|
|||
return $a;
|
||||
}
|
||||
|
||||
private function getTaskRowById(int $id, bool $getListName = false): ?array
|
||||
private function getTaskRowById(int $id, bool $getListName = false): array
|
||||
{
|
||||
$r = DBCore::default()->getTaskById($id);
|
||||
if (!$r) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue