From 32e7ddf21bcf539f3a2a77285b585a133b361134 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Tue, 18 May 2021 04:54:37 +0000
Subject: [PATCH] Improved parameter assignment

---
 src/Module/Api/Mastodon/Accounts/Search.php | 6 +++---
 src/Module/Api/Mastodon/Search.php          | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php
index f74e35713c..30031a3d1c 100644
--- a/src/Module/Api/Mastodon/Accounts/Search.php
+++ b/src/Module/Api/Mastodon/Accounts/Search.php
@@ -46,11 +46,11 @@ class Search extends BaseApi
 		// What to search for
 		$q = $_REQUEST['q'] ?? '';
 		// Maximum number of results. Defaults to 40.
-		$limit = (int)$_REQUEST['limit'] ?? 40;
+		$limit = (int)($_REQUEST['limit'] ?? 40);
 		// Attempt WebFinger lookup. Defaults to false. Use this when q is an exact address.
-		$resolve = (bool)!isset($_REQUEST['resolve']) ? false : ($_REQUEST['resolve'] == 'true');
+		$resolve = ($_REQUEST['resolve'] ?? '') == 'true';
 		// Only who the user is following. Defaults to false.
-		$following = (bool)!isset($_REQUEST['following']) ? false : ($_REQUEST['following'] == 'true');
+		$following = ($_REQUEST['following'] ?? '') == 'true';
 
 		$accounts = [];
 
diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php
index b964b35db8..2da3f341c4 100644
--- a/src/Module/Api/Mastodon/Search.php
+++ b/src/Module/Api/Mastodon/Search.php
@@ -55,17 +55,17 @@ class Search extends BaseApi
 		// Enum(accounts, hashtags, statuses)
 		$type = $_REQUEST['type'] ?? '';
 		// Filter out unreviewed tags? Defaults to false. Use true when trying to find trending tags.
-		$exclude_unreviewed = (bool)!isset($_REQUEST['exclude_unreviewed']) ? false : ($_REQUEST['exclude_unreviewed'] == 'true');
+		$exclude_unreviewed = ($_REQUEST['exclude_unreviewed'] ?? '') == 'true';
 		// The search query
 		$q = $_REQUEST['q'] ?? '';
 		// Attempt WebFinger lookup. Defaults to false.
-		$resolve = (bool)!isset($_REQUEST['resolve']) ? false : ($_REQUEST['resolve'] == 'true');
+		$resolve = ($_REQUEST['resolve'] ?? '') == 'true';
 		// Maximum number of results to load, per type. Defaults to 20. Max 40.
 		$limit = (int)($_REQUEST['limit'] ?? 20);
 		// Offset in search results. Used for pagination. Defaults to 0.
 		$offset = (int)($_REQUEST['offset'] ?? 0);
 		// Only who the user is following. Defaults to false.
-		$following = (bool)!isset($_REQUEST['following']) ? false : ($_REQUEST['following'] == 'true');
+		$following = ($_REQUEST['following'] ?? '') == 'true';
 
 		$result = ['accounts' => [], 'statuses' => [], 'hashtags' => []];