diff --git a/classes/helper.php b/classes/helper.php
index aa831134..6bffc96b 100644
--- a/classes/helper.php
+++ b/classes/helper.php
@@ -444,7 +444,9 @@ public static function sanitize_json_string(string $jsonstring): string {
foreach ($json as $key => $value) {
unset($json[$key]);
$key = clean_param(clean_param($key, PARAM_CLEANHTML), PARAM_NOTAGS);
- $json[$key] = is_array($value) ? clean_param_array($value, PARAM_CLEANHTML, true) : clean_param($value, PARAM_CLEANHTML);
+ $json[$key] = is_array($value)
+ ? clean_param_array($value, PARAM_CLEANHTML, true)
+ : clean_param($value, PARAM_CLEANHTML);
}
return json_encode($json);
}
diff --git a/tests/boardmanager_test.php b/tests/boardmanager_test.php
index 5e607408..09f23e7a 100644
--- a/tests/boardmanager_test.php
+++ b/tests/boardmanager_test.php
@@ -321,9 +321,9 @@ public function test_can_user_manage_specific_card() {
/**
* Tests the json sanitization function.
*
- * @dataProvider test_sanitize_json_string_provider
- * @param $jsonstring string the json string to sanitize
- * @param $sanitized string the expected sanitized json string
+ * @dataProvider sanitize_json_string_provider
+ * @param string $jsonstring the json string to sanitize
+ * @param string $sanitized the expected sanitized json string
* @return void
*/
public function test_sanitize_json_string(string $jsonstring, string $sanitized): void {
@@ -336,24 +336,24 @@ public function test_sanitize_json_string(string $jsonstring, string $sanitized)
*
* @return array[] containing the keys 'json' and 'expected'
*/
- public function test_sanitize_json_string_provider(): array {
+ public static function sanitize_json_string_provider(): array {
return [
[
'json' => '{"test": "bad html"}',
- 'expected' => '{"test":"bad html<\/b>"}'
+ 'expected' => '{"test":"bad html<\/b>"}',
],
[
'json' => '{"test": "good html"}',
- 'expected' => '{"test":"good html<\/b>"}'
+ 'expected' => '{"test":"good html<\/b>"}',
],
[
'json' => '{"test": "good html","anotherkey": [{"nestedkey":""}]}',
- 'expected' => '{"test":"good html<\/b>","anotherkey":[{"nestedkey":""}]}'
+ 'expected' => '{"test":"good html<\/b>","anotherkey":[{"nestedkey":""}]}',
],
[
'json' => '{"test": "good html"}',
- 'expected' => '{"test":"good html<\/b>"}'
- ]
+ 'expected' => '{"test":"good html<\/b>"}',
+ ],
];
}
}