Use empty() over === false to also return error in case of empty strings

This commit is contained in:
jrenslin committed 2023-11-10 16:17:20 +01:00
1 parent 0fb368b96d
commit db31822a3f
1 file changed
+1 -1
+1 -1
View File
@@ -96,7 +96,7 @@ public static function sanitize_text(mixed $input):string {
*/
public static function sanitize_rgb_color(mixed $input):string {
if (($output = \filter_var($input, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)) === false) {
if (empty($output = \filter_var($input, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH))) {
throw new MDInvalidColorCode("Invalid color code provided: " . $output);
}