From b8f0627a0e5480d872eb1d64224cdfbfcd92b1b8 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sun, 14 Nov 2021 20:03:57 +0000 Subject: [PATCH] Address PHPStan warning in 'classes/pref/labels.php'. --- classes/pref/labels.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/classes/pref/labels.php b/classes/pref/labels.php index 81b85481b..a50a85a66 100644 --- a/classes/pref/labels.php +++ b/classes/pref/labels.php @@ -7,7 +7,7 @@ class Pref_Labels extends Handler_Protected { return array_search($method, $csrf_ignored) !== false; } - function edit() { + function edit(): void { $label = ORM::for_table('ttrss_labels2') ->where('owner_uid', $_SESSION['uid']) ->find_one($_REQUEST['id']); @@ -17,7 +17,7 @@ class Pref_Labels extends Handler_Protected { } } - function getlabeltree() { + function getlabeltree(): void { $root = array(); $root['id'] = 'root'; $root['name'] = __('Labels'); @@ -48,10 +48,9 @@ class Pref_Labels extends Handler_Protected { $fl['items'] = array($root); print json_encode($fl); - return; } - function colorset() { + function colorset(): void { $kind = clean($_REQUEST["kind"]); $ids = explode(',', clean($_REQUEST["ids"])); $color = clean($_REQUEST["color"]); @@ -84,7 +83,7 @@ class Pref_Labels extends Handler_Protected { } } - function colorreset() { + function colorreset(): void { $ids = explode(',', clean($_REQUEST["ids"])); foreach ($ids as $id) { @@ -101,7 +100,7 @@ class Pref_Labels extends Handler_Protected { } } - function save() { + function save(): void { $id = clean($_REQUEST["id"]); $caption = clean($_REQUEST["caption"]); @@ -148,9 +147,9 @@ class Pref_Labels extends Handler_Protected { } - function remove() { - - $ids = explode(",", clean($_REQUEST["ids"])); + function remove(): void { + /** @var array */ + $ids = array_map("intval", explode(",", clean($_REQUEST["ids"]))); foreach ($ids as $id) { Labels::remove($id, $_SESSION["uid"]); @@ -158,7 +157,7 @@ class Pref_Labels extends Handler_Protected { } - function add() { + function add(): void { $caption = clean($_REQUEST["caption"]); $output = clean($_REQUEST["output"] ?? false); @@ -171,7 +170,7 @@ class Pref_Labels extends Handler_Protected { } } - function index() { + function index(): void { ?>